The GBML manual

GBML's own language and engine reference — written for this language and this machine.

Start here: Getting started

Getting started

3D

3D view
How a room becomes a 3D corridor you walk through: the view from inside, drawn from the room's tiles by code, with walls, a flat floor and ceiling, walking and turning.
Making 3D walls
How a room's tiles become walls, how a tile picks its wall picture, and how to make the wall pictures.
Collision in 3D
How the camera walks without going through walls, and how to ask the map what is ahead.
Enemies and items in 3D
How to put enemies, items and bolts in the 3D view: things drawn standing in the room, hidden behind walls, with a line of sight, a shot that finds the first target, and sliding doors.
Speed: why 30 frames
What the 3D view costs the console, why a 3D game is happy at 30 frames a second, and what makes it faster.
view3d_active
True while the 3D view is on.
view3d_angle
The way the camera faces, in degrees from 0 up to just under 360 (0 looks right, 90 looks up the room).
view3d_camera
Puts the camera at (x, y) in the room, facing angle degrees (0 looks right, 90 looks up the room, counter-clockwise).
view3d_colors
Sets the flat colors of the ceiling and the floor. Use color literals like #3A4A6A.
view3d_door
Makes the wall tile at (x, y) a sliding door and opens it (true) or closes it (false) over about half a second.
view3d_door_open
How far the door at (x, y) is open: 0 closed to 1 open (0 where there is no door).
view3d_draw_self
Draws this instance in the 3D view as thing number n, frame f (counted from 0), standing at the instance’s x and y in the room. Call it from the Draw event.
view3d_draw_thing
Draws thing number n, frame f, standing at (x, y) in the room and lift source pixels above the floor. The way to draw a thing that is not an instance, or one that flies (a bolt).
view3d_height
Sets how many rows of the screen the 3D view covers, counted from the top (8 to 160). The rows below it are left black, for a HUD of sprites. It starts at 160, the whole screen.
view3d_hit_wall
The number of the wall picture the last view3d_ray met (0 is the first picture).
view3d_hit_x
The x, in room pixels, where the last view3d_ray met a wall.
view3d_hit_y
The y, in room pixels, where the last view3d_ray met a wall.
view3d_line_clear
True when no wall, and no door that is not open, is between the two places: a line of sight. Use it to decide whether an enemy can see you.
view3d_move
Moves the camera forward (negative is back) and to its right (negative is left) by that many pixels, stopping at walls. True when it moved at all.
view3d_radius
Sets how close view3d_move lets the camera come to a wall, in pixels. It starts at about 2.4.
view3d_ray
Sends a ray out from the camera along angle (degrees) and answers how far it goes, in pixels, before it meets a wall.
view3d_shading
Draws every wall farther than this many pixels in its darker shade, which makes far walls fade into shadow. 0 turns it off, and it starts off.
view3d_shoot
The first instance of obj that a shot from the camera along angle (degrees) reaches within range pixels, before it meets a wall, or nothing. It is what a gun asks.
view3d_start
Shows the room from inside: every solid tile is a wall, drawn in the picture you name, and the floor and ceiling are flat colors. Call it once, in the Create event of the object that runs the view.
view3d_stop
Leaves the 3D view. The room’s own pictures are not brought back: enter the room again (room_restart) to see them.
view3d_thing
Says which picture is thing number n: an enemy, an item, anything that stands in the view. The picture holds the thing’s frames one above the other, each frame_height rows tall. Call it in the Create event of the object that starts the view, with plain numbers.
view3d_turn
Turns the camera left by that many degrees (negative turns right).
view3d_width
Sets how wide the view is across the screen, in degrees (30 to 120). It starts at 66.
view3d_x
The camera’s x in the room, in pixels.
view3d_y
The camera’s y in the room, in pixels.

Arrays

Arrays
array is the plainest data container - a fixed number of slots, indexed by position, that can never grow or shrink once declared.
array_contains
True if any place in target holds a value equal to value, false otherwise.
array_copy
Makes a new array that is a copy of source: the same number of places, holding the same values. Changing the copy never changes source, and the other way round. It goes on the right-hand side of the line that makes the variable, like array_create, and it costs a whole second array of memory.
array_create
Makes an array with size slots, every one starting as fill. The kind of array follows from fill: array_create(5, 0) is an array, array_create(3, 0.0) an array. size must be a whole number written right there in the code.
array_filter
Makes a new LIST of just the values of target that the script test says yes to, in their original order. test is the NAME of one of your scripts; it takes one argument and gives back true or false. The answer is a list, not an array, because how many pass is only known while the game runs. target is not changed.
array_find
Gives back the place (the index; 0 is the first place) of the first place in target that holds a value equal to value, or -1 if value is not in target at all. If you only want to know yes or no, array_contains does that.
array_foreach
Runs the script action once for each place of target, from the first to the last, handing it that place's value. action is the NAME of one of your scripts and it must take exactly one argument. It is the same as writing a loop over target that calls the script with target[i].
array_length
How many places target has - the places you can reach with target[i], from 0 up to one less than this. For an array made with array_create, or written out with a value for every place, that is the size you gave it.
array_max
Gives back the biggest number target has: array_max(scores) of 7, 3 and 9 is 9. Use it for the best score or the tallest tower.
array_min
Gives back the smallest number target has: array_min(scores) of 7, 3 and 9 is 3. Use it for the lowest cooldown or the shortest distance.
array_reverse
Turns the order of the places in target around, in place: the first place takes the value the last one held and the other way round, all the way to the middle. It changes target itself and makes no copy. Any kind of value can be reversed, text included.
array_shuffle
Mixes up the order of the places in target, in place: afterwards it holds the same values in a random order. It makes no copy. Any kind of value can be shuffled, text included.
array_sort
Puts the places of target in order. Numbers go smallest first when ascending is true and biggest first when it is false. Text goes in alphabetical order when ascending is true (Z to A when it is false), with one catch: every capital letter comes before every small letter. It changes target itself and makes no copy. An array of yes-or-no values, structs or references is refused when the project is checked.
array_sum
Adds up all the numbers target has: array_sum(gold) of 5, 10 and 20 is 35. Use it for the total gold, damage or points.

Audio

Sound and input
A map of the two ways a game talks to the player - sound out, buttons in - and which page covers which.
Sound and music
The GBA plays one song at a time plus up to four sound effects on top, and GBML gives you separate functions for each because they work differently.
Sound effects
Make a jump, coin, hit, explosion or laser in the Music tab's sound effects generator, and choose per sound whether it is a tiny chip sound or a recording.
music_current
Whatever music_play/music_fade_to last targeted, even mid-fade - nothing-equivalent if silence is the target.
music_fade_to
Fades whatever is currently audible out, then fades m in - one Direct Sound channel, so this is always sequential, never a true overlap.
music_fading
True while a music_fade_to is still going on - the old song fading out, then the new one fading in - and false once the music has settled.
music_pitch
Sets the pitch (1 = normal, 2 = an octave up, 0.5 = an octave down) of the music currently playing, in the range 0.5..2.
music_play
Starts a song playing AT ONCE - stops whatever was playing first, no fade. Right for a title screen’s very first song (nothing to fade from); see music_fade_to for the crossfade a room-to-room change should use.
music_position
Jumps the music currently playing to sequence position `position` - which entry of the tracker’s own pattern order list plays next.
music_stop
Stops music AT ONCE, no fade.
music_tempo
Sets the tempo (song speed - 1 = normal, 2 = double speed) of the music currently playing, in the range 0.5..2, independent of pitch.
music_volume
How loud the music is playing right now, from 0 (silent) to 1 (full) - during a fade it falls to 0 and climbs back, one step a frame, exactly as it is heard.
sound_gain
A GLOBAL volume multiplier (0..1), applied to every sound_play() from here on - a project’s own "sound effects volume" setting.
sound_pan
Sets the panning (-1 hard left .. 0 center .. 1 hard right) of s’s own currently-playing instance - the same "still remembers one" instance sound_stop/sound_playing already look up by s alone.
sound_play
Plays a sound effect once, at volume (0..1) times the current sound_gain() multiplier. Leave volume out for full volume.
sound_playing
True if this sound is currently playing.
sound_speed
Sets the playback rate (1 = normal, 2 = double speed, 0.5 = half speed...) of s’s own currently-playing instance - same "no-op if not tracked" rule as sound_pan.
sound_stop
Stops the currently-playing instance of this sound, if the engine still remembers one - a no-op if it already finished or was never playing.

Backgrounds

Backgrounds
A background is a big picture built from 8x8 tiles that the hardware scrolls as one piece - not an instance, and only four can be shown at once.
Tile layers - Front, Main and Back
A room can paint tiles on three layers - Main (the room's own, the only one with collision), Front (over the player, like treetops) and Back (behind everything, like far hills) - each with its own scroll speed and effect.
One picture, several palettes
A background picture or a tileset drawn with up to 16 palettes of 16 colors - each 8x8 tile wears one of them - for a title screen, a backdrop or a painted room that needs more than 16 colors.
Zoomable backgrounds
A background picture the hardware can make bigger, smaller and turn - chosen room by room, because it costs that room two of its four background layers.
Perspective floor
The zoomable background drawn as a floor that runs away to a horizon, the way a racing game draws its road - set by code, with objects that stand on it, redrawn row by row by the console.
Background actors
A big picture on the turning background layer that code moves, scales and turns like an object, with sprites pinned to named points of it - for a boss too big for sprites.
EDGE_COLOR
One solid color past the edge: the color you give background_edge as its third argument.
EDGE_EMPTY
Nothing past the edge: the screen’s own color shows. The same as background_repeat(bg, false).
EDGE_REPEAT
The picture again: what the console does by itself.
EDGE_STRETCH
The picture’s outermost row and column of tiles carried outward, so the edge looks like it goes on for ever.
actor_anchor
Chooses the point of the actor's picture that actor_place puts on the room, and that actor_scale and actor_angle swell and turn the picture about. It starts at the picture's top-left corner, (0, 0).
actor_angle
Turns the Background Actor about its anchor. Counter-clockwise, like every angle here: 90 turns it a quarter turn to the left.
actor_cycle
Makes a run of the actor picture's colors take each other's places, one step every few frames, so a light seems to travel along them (a pulse in a vein). actor_cycle(72, 8, 4) steps colors 72 to 79 every 4 frames; actor_cycle(0, 0, 0) stops it.
actor_picture
Swaps the Background Actor's picture for another actor picture, written in quotes as the picture is named in the Paint tab: actor_picture("mother_p2"). Its place, scale and angle stay.
actor_pin_x
Where a named point of the Background Actor's picture (a pin, made in the Paint tab) is in the room right now, across, after the picture was moved, scaled and turned: put a sprite there and it stays on that point.
actor_pin_y
Where a named point of the Background Actor's picture is in the room right now, down: see actor_pin_x.
actor_place
Puts the Background Actor on the room: the point of its picture named by actor_anchor stands at the room position (x, y). The picture scrolls with the camera, shakes with it, and can be moved every frame.
actor_scale
Sets how big the Background Actor is drawn, about its anchor: 1 is the picture's real size, 2 twice as big, 0.5 half as big.
actor_visible
Shows or hides the Background Actor. A hidden actor costs nothing to draw.
background_blocky
Marks a background as blocky, or not, so a look from screen_mosaic can turn it into big square blocks. bg is a background made with background_create. With no mosaic look on, a marked background looks just the way it did. Does nothing for nothing, or for a background that is gone.
background_clip
Shows only a box of bg: its top-left corner is at (x, y), counted from the top-left like draw_background, and it is w wide and h tall. Nothing of the background shows outside the box.
background_clip_off
Takes the box off a background that background_clip cut down, so all of it shows again.
background_count
How many project-created backgrounds currently EXIST (created and not yet destroyed) - hidden ones included.
background_create
Loads one project-owned background from a tileset and returns a handle to it - or `nothing` if the shared hardware budget is already full. It starts HIDDEN: nothing is on the screen until a Draw event calls draw_background with the handle. (x, y) is where the picture’s top-left corner starts, counted from the room’s top-left corner; every draw_background call then says where it goes for that frame. Past the picture’s edge the console repeats the picture; the picture’s "Repeat" setting (or the optional fourth argument, true or false) says whether this background does.
background_destroy
Destroys a background created by background_create, freeing its slot for a later background_create call.
background_edge
Says what bg shows past the edge of its picture: EDGE_REPEAT (the picture again), EDGE_EMPTY (nothing), EDGE_STRETCH (the picture’s outermost row and column of tiles carried outward) or EDGE_COLOR (one solid color, the third argument).
background_look
Moves a background sideways by a different amount on every row of the screen, so a picture ripples like water, or a floor or a road runs away from you. bg is a background made with background_create, look is one of the BGLOOK_ constants, strength (1 to 3) is how strong it is, and speed is how fast it moves (what that means depends on the look). BGLOOK_NONE turns it off.
background_palette
Draws a background made with background_create in the colors of a palette instead of its picture’s own colors. background_palette(bg, nothing) puts the picture’s own colors back.
background_priority
Sets which of the 4 hardware layers bg draws on - 0 is frontmost, 3 is backmost.
background_repeat
Says whether bg repeats past the edge of its picture. true is what the console does by itself; false leaves the screen’s own color past the edge.
background_scroll_speed
Says how far bg moves compared with the camera, in percent, across and down. 100 is what a background does by itself: it moves with the room. 50 moves it half as far, so it looks far away. 0 keeps it fixed to the screen.
background_see_through
Marks a background as see-through, or not, so a look from screen_blend decides how much of it shows on each row. bg is a background made with background_create. With no blend look on, a marked background looks just the way it did. Does nothing for nothing, or for a background that is gone.
draw_background
Shows bg for this frame with its picture’s top-left corner at (x, y), counted from the room’s top-left corner. A background you made with background_create is hidden until a Draw event draws it, and it is hidden again in every frame it is not drawn. In a Draw GUI event it is fixed to the screen instead, and (x, y) counts from the screen’s top-left pixel.
draw_self_on_floor
Draws this instance on the perspective floor: its x and y are a place on the picture, and it is drawn where the floor shows that place, sized by distance, nearer in front.
draw_sprite_on_floor
Draws a picture at a place on the perspective floor (x, y on the picture) at a chosen size, nearer in front, optionally mirrored left to right. The way to give a car sizes that switch by distance.
floor_scale_at
How big something at the floor place (x, y) looks: 1 is its real size on the picture, smaller the farther away. 0 when the place is behind the camera or past the horizon.
perspective_floor
Turns the room’s zoomable background into a floor that runs away to a horizon, the way a racing game draws its road, or back into the flat picture.
perspective_floor_ahead
How far ahead of the camera, along the way it looks, the floor place (x, y) is, in picture pixels. Negative behind the camera.
perspective_floor_behind
True when the point of the last perspective_floor_project call is behind the camera, false when it was ahead (too far to draw, or fine).
perspective_floor_camera
Puts the perspective floor’s camera over the picture at (x, y) and turns it to face heading degrees.
perspective_floor_height
Sets how high the perspective floor’s camera is above the picture, in picture pixels. It starts at 16.
perspective_floor_horizon
Sets the screen row where the perspective floor starts, counted down from the top of the screen. Rows above it show the room’s other pictures. It starts a third of the way down.
perspective_floor_project
Works out where a point on the picture (x, y) appears on the screen, so a car or a pickup can be drawn on the road. True when the point is ahead of the camera and nearer than the horizon.
perspective_floor_scale
How big something standing at the point of the last perspective_floor_project call should be drawn: 1 is its real size on the picture, 0.5 half of it. It shrinks toward the horizon.
perspective_floor_screen_x
The screen x, counted from the screen’s top-left pixel, that the last perspective_floor_project call found for its point.
perspective_floor_screen_y
The screen y, counted down from the screen’s top-left pixel, where the point the last perspective_floor_project call found touches the floor.
perspective_floor_view
Sets how wide the perspective floor’s camera sees across the screen, in degrees. It starts at 90.
room_layer_look
Moves one of the room’s tile layers sideways by a different amount on every row of the screen, so only that layer ripples like water while the others stay still. layer is ROOM_LAYER_MAIN, ROOM_LAYER_FRONT or ROOM_LAYER_BACK, look is one of the BGLOOK_ constants, strength (1 to 3) is how strong it is, and speed is how fast it moves. BGLOOK_NONE turns it off. It is the room-layer twin of background_look.
room_layer_scroll_speed
Changes how far one of the room’s tile layers moves compared with the camera, in percent, across and down, while the game runs: the same setting as the layer’s Scroll speed in the Room Editor. 100 moves with the room, 50 moves half as far so the layer looks far away, 0 keeps it fixed to the screen.
room_layer_visible
Shows or hides one of the room’s tile layers while the game runs: room_layer_visible(ROOM_LAYER_FRONT, false) takes the Front layer off the screen, and true puts it back.
tile_layer_palette
Draws the tiles of the room you are in, its floor and walls, in the colors of a palette instead of the colors of the tileset they were painted with. tile_layer_palette(nothing) puts the tileset’s own colors back.
zoom_background_focus
Picks the spot on the screen that stays still while the room’s zoomable background zooms and turns. It starts as the middle of the screen.
zoom_background_palette
Draws the room’s zoomable background in the colors of a palette instead of the colors of its picture. zoom_background_palette(nothing) puts the picture’s own colors back.
zoom_background_position
Moves the room’s zoomable background so that its picture’s top-left corner is at the screen position (x, y).
zoom_background_priority
Sets which of the 4 hardware layers the room’s zoomable background draws on - 0 is frontmost, 3 is backmost. It starts on 3.
zoom_background_repeat
Says whether the room’s zoomable background repeats past the edge of its picture. It starts as false: past the edge the screen’s own color shows.
zoom_background_rotation
Turns the room’s zoomable background to this many degrees: 0 is straight, and bigger numbers turn it counter-clockwise on the screen, the same way every angle in this manual does.
zoom_background_scale
Sets how big the room’s zoomable background is drawn: 1 is its real size, 2 is twice as big, 0.5 is half as big.
zoom_background_visible
Shows or hides the room’s zoomable background. It is showing when the room starts.

Camera

The camera
The screen is a 240x160 window onto a world that can be much bigger, and the camera decides which part of that world the window shows.
camera_bounds
Clamps every eased/set camera position into this rectangle (where the view may begin: typically from the room’s top-left corner (0, 0) to (room_width() - screen_width(), room_height() - screen_height()), so the screen never shows past an edge). A room’s own load sets this automatically.
camera_bounds_clear
Removes the camera_bounds clamp entirely.
camera_dead_zone
A box in the middle of the view, width by height pixels, inside which the followed target can move without the camera moving. The camera moves only to keep the target inside the box. 0 and 0 (the default) is no box.
camera_follow
Switches to eased auto-follow: every frame, the camera eases toward target’s current position (clamped to camera_bounds, if any are set), using IGUN’s own integer-lag rule exactly.
camera_follow_ease
Configures how fast camera_follow’s eased catch-up closes the remaining whole-pixel gap each frame, independently per axis. Defaults to 0.08/0.08 (today’s built-in feel) until this is called.
camera_look_ahead
The camera looks distance pixels ahead of the way the followed target is moving, and swings to the other side speed pixels a frame when the target turns round (0 or less: at once). A distance of 0 (the default) is no look-ahead.
camera_offset
The followed camera is centered on the target plus x across and y down, in pixels: a positive x shows more of what lies to the right of the target, a positive y more of what lies below it. 0 and 0 (the default) is exactly the target.
camera_set
Stops following (if it was) and immediately places the camera so that its view begins at (x, y) - the top-left corner of what the screen shows, counted from the room’s top-left corner - still clamped to camera_bounds if any are set - an exact, unshimmering jump, not a multi-frame ease.
camera_shake
A temporary random jitter, power pixels at its peak, linearly decaying to 0 over frames. power<=0 or frames<=0 stops any shake in progress at once.
camera_snap
If currently following, jumps AT ONCE (no easing) to the target’s current clamped position. Follow mode stays active; a no-op if not following or the target no longer exists.
camera_unfollow
Stops auto-follow. The camera stays exactly where it was until camera_set/camera_follow is called again.
camera_x
Where the camera’s view begins, across: the x of the left edge of what the screen shows, counted from the room’s top-left corner.
camera_y
Where the camera’s view begins, down: the y of the top edge of what the screen shows, counted from the room’s top-left corner.

Collision

Overlap and collision
How the game decides two things touch - a rectangle around each instance - and the two ways to use that answer, the Collision event and the overlap functions.
Slopes
How a collision square can be a ramp instead of a full block - the shapes there are, how a walker climbs and descends them, and the three functions that read and change them.
One-way platforms
A floor you can jump up through and then stand on. Paint it with the One-way button, and see how the player, your own code and falling things treat it.
Collision layers
How to make a door that opens, a bridge that appears or a wall that falls down - draw each state of the room as a layer in the Room Editor, then switch between the layers from your code.
Never moves
A box on an object that promises its copies stay where they are put, so the game can answer collision questions about them from a look-up grid instead of checking every copy.
Tile flags
Give your own names to kinds of tile, like diggable or hurts. Paint them in the Room Editor and check for them in your code, using the same name in both places.
Autotile
A set of 13 (or 47) tiles that picks its own edge or corner from the squares around it. Draw the pieces once, then paint a pond, a wall or a path - in the Room Editor or while the game runs - and every shape gets the right edges and corners.
attack_touching
True if one of this object’s attack boxes, on the frame it is showing now, touches a body box of an instance of obj. A frame with no body box uses the object’s collision box as its body. Name more objects after the first and it is true if it touches any of them.
box_bottom
The bottom edge of this instance’s current collision box, in room pixels - the box `mask_w`/`mask_h`/`mask_x`/`mask_y` (or, failing those, `mask_sprite`/`sprite`) describe, already offset and already in room space.
box_left
The left edge of this instance’s current collision box, in room pixels - the box `mask_w`/`mask_h`/`mask_x`/`mask_y` (or, failing those, `mask_sprite`/`sprite`) describe, already offset and already in room space.
box_right
The right edge of this instance’s current collision box, in room pixels - the box `mask_w`/`mask_h`/`mask_x`/`mask_y` (or, failing those, `mask_sprite`/`sprite`) describe, already offset and already in room space.
box_top
The top edge of this instance’s current collision box, in room pixels - the box `mask_w`/`mask_h`/`mask_x`/`mask_y` (or, failing those, `mask_sprite`/`sprite`) describe, already offset and already in room space.
collides
True if this instance’s own box currently overlaps other’s.
collision_circle
The first instance of obj whose box overlaps the circle centered on (x,y) with the given radius, or nothing.
collision_line
The first instance of obj whose box the line from (x1,y1) to (x2,y2) passes through, counting from (x1,y1), or nothing. The line of sight: nothing in the way means the way is clear.
collision_point
The first instance of obj whose box contains the point (x, y), or nothing.
collision_rect
The first instance of obj whose box overlaps the rectangle from (x1,y1) to (x2,y2), or nothing.
mask_h
The height of this instance’s collision box, in pixels - ANY height, including taller than the art. 0 (the default) means auto: take the height from `mask_sprite` if one is set, else from `sprite`, else 0.
mask_sprite
Takes this instance’s collision-box SIZE (not its pixels - S2.6: "collision masks are rectangles") from another sprite’s size instead of `sprite`’s own. Outranked per axis by `mask_w`/`mask_h`; leave all of them unset to use `sprite`’s size.
mask_w
The width of this instance’s collision box, in pixels - ANY width, including wider than the art. 0 (the default) means auto: take the width from `mask_sprite` if one is set, else from `sprite`, else 0.
mask_x
How far right of this instance’s own `x` the collision box sits, in pixels (negative is left). 0 (the default) centers it on the instance, which is what every mask did before this existed.
mask_y
How far below this instance’s own `y` the collision box sits, in pixels (negative is up). 0 (the default) centers it on the instance.
point_meeting
True if there is an instance of obj (solid or not) at the single point (x, y). Name more objects after the first and it is true if there is an instance of any of them there.
pos_free
True if this instance could stand at (x, y) without overlapping a SOLID instance of obj (excluding itself). Name more objects after the first and it is true only if none of them is in the way: pos_free(x, y, obj_wall, obj_rock).
pos_meeting
True if this instance would overlap ANY instance of obj (solid or not, excluding itself) if it stood at (x, y). Name more objects after the first and it is true if it would overlap any of them.
pos_solid
True if (x, y) is inside a SOLID instance of obj - a raw probe, not tied to any particular instance (e.g. "is this spawn point clear"). Name more objects after the first and it is true if the point is inside a solid instance of any of them.
slope_feet
Chooses how the whole game’s movers meet slopes: true, they stand on their feet (a platformer: the bottom middle of the body rests on the slope and the body walks up and down it); false, the whole body meets the slope (a top-down game: a body pushed into a diagonal wall slides along it).
solid
Whether pos_free/pos_solid treat this instance as something to stop at. pos_meeting/point_meeting/collides ignore this - they report ANY overlap, solid or not.
tile_blocks_projectile
The projectile question: true only if the tile at (x, y) is TILE_SOLID - TILE_LOW_COVER lets a projectile pass (see tile_class). What a project’s own generated call should use for an object declared is_projectile, instead of tile_solid. The choice is the object’s own declared fact, never inferred by either function itself.
tile_class
The tile class at (x, y) in the current room’s collision tile layer - one of TILE_PASS, TILE_SOLID or TILE_LOW_COVER (compare with ==). tile_solid/tile_blocks_projectile already answer "does this block me" directly; reach for tile_class instead when a project needs to test for TILE_PASS explicitly.
tile_clear_auto
Empties the square at (x, y) if it is a square of the autotile `set`, and the eight squares around it look again and take the piece that fits now. The undo of tile_set_auto.
tile_flags
The raw per-tile attribute byte at (x, y) in the current room’s collision tile layer - bits 0-1 are the mutually-exclusive tile class (see tile_class/TILE_PASS/TILE_SOLID/TILE_LOW_COVER), bits 2-7 are whatever a project itself gives them.
tile_free
True if this instance’s whole collision box, standing at (x, y), would be clear of the room’s own solid ground - the tile grid and any obstacles the room has. The room-as-wall twin of pos_free: use it to ask "may I step here?" for anything that moves.
tile_ground_y
Where the ground is in one column of the room: the y of the first solid pixel at or below y in the column at x, or -1 if there is none all the way down. It follows slopes pixel by pixel, so it is the height of a ramp at that x.
tile_index
The drawn tile index at (x, y) in the current room’s own tileset right now - the getter twin of tile_set_index, for reading back what a cell currently shows (its authored picture, or whatever a project’s own tile_set_index call last changed it to).
tile_layer_active
The number of the collision layer that is on in this room right now. A room with no extra layers is always on layer 1. Use it to check before you do something, for example only open a door that is still shut.
tile_layer_set_active
Switches this room to collision layer number layer, and turns every other layer off. Layer 1 is the room the way you first drew it. Layers 2 and up are the ones you drew after it in the Room Editor. Only one layer is ever on, and it takes effect at once. Switch to a door-open layer and the door opens. Switch back to layer 1 and it shuts.
tile_one_way
True if the point (x, y) is on a One-way square of the room (a square painted One-way in the Room Editor): a platform that stops a body only when it lands on its top. Every other collision call treats a One-way square as open, so something that is not asking walks and falls straight through it.
tile_set_auto
Makes the square at (x, y) a square of the autotile `set` (write it as AUTOTILE_ and the autotile's name in capitals): the square takes the piece that fits the squares around it, and the eight squares around it look again and take the piece that fits now. Digging, building, flooding - the shape keeps its own edges and corners.
tile_set_class
Sets the tile CLASS (TILE_PASS/TILE_SOLID/TILE_LOW_COVER) at (x, y) in the current room’s collision tile layer, leaving every project-defined flag bit untouched - the setter twin of tile_class. What most destructible-terrain/dig/unlock code wants: "this cell no longer blocks" is tile_set_class(x, y, TILE_PASS).
tile_set_flags
Sets the WHOLE raw attribute byte (class bits AND every project-defined flag bit at once) at (x, y) - the setter twin of tile_flags. Reach for this instead of tile_set_class when a project needs to change one of its own flag bits (a “wet”/“hurt” bit, say) without disturbing - or while also choosing - the class in the same call.
tile_set_index
Sets the DRAWN tile index at (x, y) in the current room’s own tileset - which entry of the tileset sheet is pictured there, the same integer a room’s authored map already uses per cell. The drawing sibling of tile_set_class: paired together ("this cell no longer blocks" plus "this cell no longer looks solid"), the two are the whole of a permanent dig/destructible-terrain mechanic in one two-line call site, no extra instance needed.
tile_set_shape
Changes the shape of the collision square at (x, y) in the current room - turn a flat floor into a ramp while the game runs, or a ramp back into a flat floor with SHAPE_FULL. The class (solid, low cover, pass) and the flags of the square are left as they are.
tile_shape
The shape of the collision square at (x, y): SHAPE_FULL (0) for an ordinary square, or the number of the slope it has (SHAPE_45_FLOOR_UP_RIGHT and the other SHAPE_ names, or a number from 128 up for a shape you drew yourself).
tile_solid
The body question: true if the tile at (x, y) blocks a body - every tile class except TILE_PASS (TILE_SOLID and TILE_LOW_COVER both block a body; see tile_class). What a project’s own generated call should use for any object NOT declared is_projectile.
tile_wall
True if this instance’s whole collision box, standing at (x, y), would touch a wall of the room: a full collision square or an obstacle the room has. The edge of the room is not a wall. A slope is never a wall. It is tile_free’s answer with the ramps left out, for code that asks "is that a wall beside me?" and must not take a ramp for one.

Constants

Constants
A constant is a fixed name for a value that never changes, and GBML gives you named constants for buttons, text alignment, path endings, tile types, colors and door modes so you never type a bare number.
ALIGN_CENTER
Aligns draw_text’s (x, y) to the center of the text, for text_align.
ALIGN_LEFT
Aligns draw_text’s (x, y) to the left of the text, for text_align.
ALIGN_RIGHT
Aligns draw_text’s (x, y) to the right of the text, for text_align.
BACKDROP_ALARM
An alarm: a dark red sky with one bright red band across it that sweeps up and down the screen.
BACKDROP_AURORA
The northern lights: a dark sky with a bright green glow, a band of violet, and dark again.
BACKDROP_DAWN
A sunrise: soft lilac-blue at the top, then pink and peach, with a warm pale gold along the bottom.
BACKDROP_DAY
A clear day: strong blue at the top, getting paler toward the horizon until it is almost white.
BACKDROP_DEEP
Deep water: bright turquoise at the top, then blue, and ink-dark navy at the bottom, as if you were sinking.
BACKDROP_DESERT
A hot desert day: blue sky going pale and bleached near the horizon, then sandy orange at the bottom.
BACKDROP_EMBER
The inside of a furnace: black at the top, then dark red, hot red and orange, with a white-hot glow at the bottom.
BACKDROP_FOREST
Deep forest: shadowy green at the top, bright greens in the middle, and a sunlit yellow-green mist at the bottom.
BACKDROP_NEON
A neon night: black-violet at the top, electric purple and hot pink in the middle, and a glowing cyan edge at the bottom.
BACKDROP_NIGHT
A night sky: ink-dark blue at the top, with a dim violet glow low down.
BACKDROP_NONE
No special backdrop: the screen goes back to the room's own background color.
BACKDROP_OCEAN
The sea on a sunny day: blue sky, a bright line at the horizon, and turquoise water below that gets darker the lower it goes.
BACKDROP_RAINBOW
A rainbow: red at the top, then yellow, green, cyan and blue, ending in violet at the bottom.
BACKDROP_STORM
A storm sky: almost black at the top, then slate and a cold grey-green, with a pale sickly glow where the sky meets the sea.
BACKDROP_SUNSET
A sunset sky: deep blue at the top, then purple, rose and orange, with a golden glow at the bottom.
BGLOOK_FLOOR
A scrolling floor: the lower a row is on the screen, the faster it slides, so a flat picture looks like a floor going away from you.
BGLOOK_NONE
No background look: the background is drawn straight again.
BGLOOK_ROAD
A winding road: the picture swings to the left and to the right, more and more toward the bottom of the screen.
BGLOOK_SWAY
A slow sway: the picture bends one way and then the other as you go down the screen, like a dream.
BGLOOK_WAVE
A ripple: the picture sways left and right as you go down the screen, like a reflection in water.
BLEND_BLINDS
Blinds: stripes 8 rows tall, a strong one then a weaker one, like light through window blinds.
BLEND_FADE_DOWN
A fade toward the bottom: a see-through thing shows fully at the top of the screen and fades away down to the bottom.
BLEND_FADE_UP
A fade toward the top: a see-through thing shows fully at the bottom of the screen and fades away up to the top.
BLEND_NONE
No blend look: see-through things go back to showing the same amount on every row.
BLEND_VIGNETTE
A vignette: a see-through thing is weakest across the middle of the screen and strongest at the top and the bottom.
BLEND_WAVE
A rolling wave: bands of strong and weak roll down the screen, slowly, like breathing.
BTN_A
The GBA’s A button, for btn_held/btn_pressed/btn_released.
BTN_B
The GBA’s B button, for btn_held/btn_pressed/btn_released.
BTN_C
The Sega Genesis pad’s C button, for btn_held/btn_pressed/btn_released.
BTN_DOWN
The GBA’s DOWN button, for btn_held/btn_pressed/btn_released.
BTN_L
The GBA’s L button, for btn_held/btn_pressed/btn_released.
BTN_LEFT
The GBA’s LEFT button, for btn_held/btn_pressed/btn_released.
BTN_MODE
The Sega Genesis pad’s Mode button, for btn_held/btn_pressed/btn_released.
BTN_R
The GBA’s R button, for btn_held/btn_pressed/btn_released.
BTN_RIGHT
The GBA’s RIGHT button, for btn_held/btn_pressed/btn_released.
BTN_SELECT
The GBA’s SELECT button, for btn_held/btn_pressed/btn_released.
BTN_START
The GBA’s START button, for btn_held/btn_pressed/btn_released.
BTN_UP
The GBA’s UP button, for btn_held/btn_pressed/btn_released.
BTN_X
The Sega Genesis pad’s X button, for btn_held/btn_pressed/btn_released.
BTN_Y
The Sega Genesis pad’s Y button, for btn_held/btn_pressed/btn_released.
BTN_Z
The Sega Genesis pad’s Z button, for btn_held/btn_pressed/btn_released.
COLOR_BLACK
The color Black, for draw_rect_fill and draw_rect.
COLOR_BLUE
The color Blue, for draw_rect_fill and draw_rect.
COLOR_CYAN
The color Cyan, for draw_rect_fill and draw_rect.
COLOR_GREEN
The color Green, for draw_rect_fill and draw_rect.
COLOR_MAGENTA
The color Magenta, for draw_rect_fill and draw_rect.
COLOR_RED
The color Red, for draw_rect_fill and draw_rect.
COLOR_WHITE
The color White, for draw_rect_fill and draw_rect.
COLOR_YELLOW
The color Yellow, for draw_rect_fill and draw_rect.
DISTORT_BULGE
A barrel: the sprite is full width in the middle and narrower toward the top and the bottom.
DISTORT_LEAN_BACK
Tipped back: the sprite is full width at the bottom and narrower toward the top, like a sign leaning away from you.
DISTORT_LEAN_FORWARD
Tipped forward: the sprite is full width at the top and narrower toward the bottom.
DISTORT_NONE
No distortion: the sprite is drawn at its real width again.
DISTORT_PINCH
An hourglass: the sprite is full width at the top and the bottom and pinched in at the waist.
DISTORT_WAVE
A jelly wave: the sprite gets narrower and wider as you go down it, so both its edges ripple.
DOOR_ENTER_ONLY
Enter only - this door sends, but is never an arrival target.
DOOR_EXIT_ONLY
Exit only - this door receives, but never sends, even if walked into.
DOOR_TWO_WAY
Two-way - this door both sends (Enter) and receives (Exit).
EASE_BACK_IN
Pulls back a little before it sets off, like drawing a bow before the arrow flies. The number goes about 10% the wrong way first, so it leaves the range from the start to the end.
EASE_BACK_IN_OUT
Pulls back a little, rushes across, overshoots the end a little and settles on it. The number goes about 10% outside the range at both ends.
EASE_BACK_OUT
Rushes to the end, runs a little past it and comes back - a move that overshoots and settles. The number goes about 10% past the end for a moment, so it leaves the range from the start to the end.
EASE_BOUNCE_IN
Starts with small bounces that grow bigger and then rushes the last of the way - a dropped ball played backwards. Never goes outside the range from the start to the end.
EASE_BOUNCE_IN_OUT
Bounces away from the start, crosses the middle, then bounces into the end. Never goes outside the range from the start to the end.
EASE_BOUNCE_OUT
Falls to the end like a dropped ball and bounces three more times, each smaller than the last, until it rests. Never goes past the end.
EASE_ELASTIC_IN
Wobbles with bigger and bigger swings, like a spring being wound up, and then arrives. The number swings behind the start by over a third of the distance, so it leaves the range.
EASE_ELASTIC_IN_OUT
A spring at both ends: it winds up with growing wobbles, crosses the middle, then overshoots and wobbles round the end. The number goes about 12% outside the range at both ends.
EASE_ELASTIC_OUT
Shoots to the end, goes past it by over a third of the distance, then wobbles round it with smaller and smaller swings until it rests - like a spring let go. The number leaves the range from the start to the end.
EASE_LINEAR
The same speed from start to finish - no speeding up and no slowing down.
EASE_QUAD_IN
Starts slowly and speeds up, more strongly than SINE_IN - something that falls, or a car pulling away.
EASE_QUAD_IN_OUT
Starts slowly, is fastest in the middle and brakes to arrive, more strongly than SINE_IN_OUT - a move with a clear start and a clear stop.
EASE_QUAD_OUT
Starts fast and brakes, more strongly than SINE_OUT - something that is thrown and settles, or a menu that slides in and stops.
EASE_SINE_IN
Starts slowly and speeds up, gently - a soft way to begin a move.
EASE_SINE_IN_OUT
Starts slowly, is fastest in the middle, and slows down again to arrive - gentle at both ends.
EASE_SINE_OUT
Starts fast and slows down gently as it arrives - a soft way to end a move.
MOSAIC_BANDS
Bands: stripes 8 rows tall, a blocky one then a sharp one, that crawl down the screen.
MOSAIC_BLOCKS
Blocks: the whole picture turns into big square blocks, the same size on every row.
MOSAIC_DISSOLVE
A dissolve: the picture is blocky at the top of the screen and sharp at the bottom, and the line between them moves.
MOSAIC_NONE
No mosaic look: the pictures you marked as blocky go back to being sharp.
PATH_CONTINUE
Keeps going in the last direction, in a straight line, past the end of the path.
PATH_LOOP
Jumps back to the start and keeps going.
PATH_PING_PONG
Reverses direction and follows the path backward.
PATH_STOP
Stops at the end of the path.
PROFILE_TOTAL
The whole frame, for the profile_ calls: everything the game did, all the phases added up.
ROOM_LAYER_ALL
No one layer: the whole screen. It is what screen_blend and screen_mosaic mean when they are given no layer, so a call that never names a layer works exactly as it always did.
ROOM_LAYER_BACK
The Back tile layer of the room: tiles painted behind the Main layer. A room without one does nothing for it.
ROOM_LAYER_FRONT
The Front tile layer of the room: tiles painted in front of the Main layer. A room without one does nothing for it.
ROOM_LAYER_MAIN
The room’s own tiles - the layer with the collision, and the one tile_index and tile_set_index mean when they are given no layer.
SCANLINES_CRT
Television lines: some rows have their green swapped, others not, so the picture gets the fine stripes of an old television.
SCANLINES_NONE
No scanline look: the screen goes back to the green swap you chose with green_swap.
SCANLINES_ROLL
A rolling bar: a band of rows has its green swapped and rolls slowly down the screen, like the hum bar on an old television.
SCANLINES_STATIC
Static: rows picked at random have their green swapped, so the picture buzzes with noise.
SHAPE_11_CEILING_DOWN_LEFT_1
A 11.25 degree slope: ceiling falling to the left, piece 1 of 4.
SHAPE_11_CEILING_DOWN_LEFT_2
A 11.25 degree slope: ceiling falling to the left, piece 2 of 4.
SHAPE_11_CEILING_DOWN_LEFT_3
A 11.25 degree slope: ceiling falling to the left, piece 3 of 4.
SHAPE_11_CEILING_DOWN_LEFT_4
A 11.25 degree slope: ceiling falling to the left, piece 4 of 4.
SHAPE_11_CEILING_DOWN_RIGHT_1
A 11.25 degree slope: ceiling falling to the right, piece 1 of 4.
SHAPE_11_CEILING_DOWN_RIGHT_2
A 11.25 degree slope: ceiling falling to the right, piece 2 of 4.
SHAPE_11_CEILING_DOWN_RIGHT_3
A 11.25 degree slope: ceiling falling to the right, piece 3 of 4.
SHAPE_11_CEILING_DOWN_RIGHT_4
A 11.25 degree slope: ceiling falling to the right, piece 4 of 4.
SHAPE_11_FLOOR_UP_LEFT_1
A 11.25 degree slope: floor rising to the left, piece 1 of 4.
SHAPE_11_FLOOR_UP_LEFT_2
A 11.25 degree slope: floor rising to the left, piece 2 of 4.
SHAPE_11_FLOOR_UP_LEFT_3
A 11.25 degree slope: floor rising to the left, piece 3 of 4.
SHAPE_11_FLOOR_UP_LEFT_4
A 11.25 degree slope: floor rising to the left, piece 4 of 4.
SHAPE_11_FLOOR_UP_RIGHT_1
A 11.25 degree slope: floor rising to the right, piece 1 of 4.
SHAPE_11_FLOOR_UP_RIGHT_2
A 11.25 degree slope: floor rising to the right, piece 2 of 4.
SHAPE_11_FLOOR_UP_RIGHT_3
A 11.25 degree slope: floor rising to the right, piece 3 of 4.
SHAPE_11_FLOOR_UP_RIGHT_4
A 11.25 degree slope: floor rising to the right, piece 4 of 4.
SHAPE_22_CEILING_DOWN_LEFT_1
A 22.5 degree slope: ceiling falling to the left, piece 1 of 2.
SHAPE_22_CEILING_DOWN_LEFT_2
A 22.5 degree slope: ceiling falling to the left, piece 2 of 2.
SHAPE_22_CEILING_DOWN_RIGHT_1
A 22.5 degree slope: ceiling falling to the right, piece 1 of 2.
SHAPE_22_CEILING_DOWN_RIGHT_2
A 22.5 degree slope: ceiling falling to the right, piece 2 of 2.
SHAPE_22_FLOOR_UP_LEFT_1
A 22.5 degree slope: floor rising to the left, piece 1 of 2.
SHAPE_22_FLOOR_UP_LEFT_2
A 22.5 degree slope: floor rising to the left, piece 2 of 2.
SHAPE_22_FLOOR_UP_RIGHT_1
A 22.5 degree slope: floor rising to the right, piece 1 of 2.
SHAPE_22_FLOOR_UP_RIGHT_2
A 22.5 degree slope: floor rising to the right, piece 2 of 2.
SHAPE_45_CEILING_DOWN_LEFT
A 45 degree slope: ceiling falling to the left.
SHAPE_45_CEILING_DOWN_RIGHT
A 45 degree slope: ceiling falling to the right.
SHAPE_45_FLOOR_UP_LEFT
A 45 degree slope: floor rising to the left.
SHAPE_45_FLOOR_UP_RIGHT
A 45 degree slope: floor rising to the right.
SHAPE_67_CEILING_DOWN_LEFT_1
A 67.5 degree slope: ceiling falling to the left, piece 1 of 2 (steeper than 45 degrees: a wall that is slid down).
SHAPE_67_CEILING_DOWN_LEFT_2
A 67.5 degree slope: ceiling falling to the left, piece 2 of 2 (steeper than 45 degrees: a wall that is slid down).
SHAPE_67_CEILING_DOWN_RIGHT_1
A 67.5 degree slope: ceiling falling to the right, piece 1 of 2 (steeper than 45 degrees: a wall that is slid down).
SHAPE_67_CEILING_DOWN_RIGHT_2
A 67.5 degree slope: ceiling falling to the right, piece 2 of 2 (steeper than 45 degrees: a wall that is slid down).
SHAPE_67_FLOOR_UP_LEFT_1
A 67.5 degree slope: floor rising to the left, piece 1 of 2 (steeper than 45 degrees: a wall that is slid down).
SHAPE_67_FLOOR_UP_LEFT_2
A 67.5 degree slope: floor rising to the left, piece 2 of 2 (steeper than 45 degrees: a wall that is slid down).
SHAPE_67_FLOOR_UP_RIGHT_1
A 67.5 degree slope: floor rising to the right, piece 1 of 2 (steeper than 45 degrees: a wall that is slid down).
SHAPE_67_FLOOR_UP_RIGHT_2
A 67.5 degree slope: floor rising to the right, piece 2 of 2 (steeper than 45 degrees: a wall that is slid down).
SHAPE_78_CEILING_DOWN_LEFT_1
A 78.75 degree slope: ceiling falling to the left, piece 1 of 4 (steeper than 45 degrees: a wall that is slid down).
SHAPE_78_CEILING_DOWN_LEFT_2
A 78.75 degree slope: ceiling falling to the left, piece 2 of 4 (steeper than 45 degrees: a wall that is slid down).
SHAPE_78_CEILING_DOWN_LEFT_3
A 78.75 degree slope: ceiling falling to the left, piece 3 of 4 (steeper than 45 degrees: a wall that is slid down).
SHAPE_78_CEILING_DOWN_LEFT_4
A 78.75 degree slope: ceiling falling to the left, piece 4 of 4 (steeper than 45 degrees: a wall that is slid down).
SHAPE_78_CEILING_DOWN_RIGHT_1
A 78.75 degree slope: ceiling falling to the right, piece 1 of 4 (steeper than 45 degrees: a wall that is slid down).
SHAPE_78_CEILING_DOWN_RIGHT_2
A 78.75 degree slope: ceiling falling to the right, piece 2 of 4 (steeper than 45 degrees: a wall that is slid down).
SHAPE_78_CEILING_DOWN_RIGHT_3
A 78.75 degree slope: ceiling falling to the right, piece 3 of 4 (steeper than 45 degrees: a wall that is slid down).
SHAPE_78_CEILING_DOWN_RIGHT_4
A 78.75 degree slope: ceiling falling to the right, piece 4 of 4 (steeper than 45 degrees: a wall that is slid down).
SHAPE_78_FLOOR_UP_LEFT_1
A 78.75 degree slope: floor rising to the left, piece 1 of 4 (steeper than 45 degrees: a wall that is slid down).
SHAPE_78_FLOOR_UP_LEFT_2
A 78.75 degree slope: floor rising to the left, piece 2 of 4 (steeper than 45 degrees: a wall that is slid down).
SHAPE_78_FLOOR_UP_LEFT_3
A 78.75 degree slope: floor rising to the left, piece 3 of 4 (steeper than 45 degrees: a wall that is slid down).
SHAPE_78_FLOOR_UP_LEFT_4
A 78.75 degree slope: floor rising to the left, piece 4 of 4 (steeper than 45 degrees: a wall that is slid down).
SHAPE_78_FLOOR_UP_RIGHT_1
A 78.75 degree slope: floor rising to the right, piece 1 of 4 (steeper than 45 degrees: a wall that is slid down).
SHAPE_78_FLOOR_UP_RIGHT_2
A 78.75 degree slope: floor rising to the right, piece 2 of 4 (steeper than 45 degrees: a wall that is slid down).
SHAPE_78_FLOOR_UP_RIGHT_3
A 78.75 degree slope: floor rising to the right, piece 3 of 4 (steeper than 45 degrees: a wall that is slid down).
SHAPE_78_FLOOR_UP_RIGHT_4
A 78.75 degree slope: floor rising to the right, piece 4 of 4 (steeper than 45 degrees: a wall that is slid down).
SHAPE_FULL
The ordinary, full square: every one of its 64 pixels is solid. What every collision square is until it is given a slope.
SPRITECOLOR_FIRE
Fire: the color is pale yellow at the top of the screen, then orange, then red, then dark red at the bottom.
SPRITECOLOR_ICE
Ice: the color is white at the top of the screen, then pale cyan, then blue, then deep blue at the bottom.
SPRITECOLOR_NONE
No sprite color look: the color goes back to the one in the picture.
SPRITECOLOR_RAINBOW
A rainbow: the color runs through red, yellow, green, blue and violet as it goes down the screen.
SPRITE_BAND
A band across the middle of the screen, and the sprite slides through it: full size on the middle line, then shrinking faster and faster toward the top and bottom of the band, and gone outside it. It is the same band as TEXT_BAND, the one the WARNING word of a boss introduction uses: at depth 3 it is exactly 64 rows tall. depth is how tall the band is: 1 is 128 rows, 2 is 96, 3 is 64, 4 is 48, 5 is 32 and 6 is 24.
SPRITE_BULGE
The middle of the picture stays full size and both the top and the bottom shrink away - like a picture wrapped round a barrel.
SPRITE_DRUM
A lens fixed to the middle of the screen, and the sprite slides through it: full size in the middle, narrower and shorter toward the top and bottom of the lens, gone at its edge - like a picture on a drum that is rolling past you. Move the sprite up or down and it rolls. depth is how tight the lens is: 1 is as tall as the screen, 6 is tight.
SPRITE_LEAN_BACK
The bottom of the picture stays full size and the top shrinks away - like a sign tipped back, with its top edge farther from you.
SPRITE_LEAN_FORWARD
The top of the picture stays full size and the bottom shrinks away - like a sign tipped forward, with its bottom edge farther from you.
TEXT_BAND
A band across the middle of the screen, and the words slide through it: full size on the middle line, then shrinking faster and faster toward the top and bottom of the band, and gone outside it. It is the shape of the WARNING word in a boss introduction: at depth 3 the band is exactly 64 rows tall (32 rows above the middle line and 32 below it), and the size drops with the square of the distance. depth is how tall the band is: 1 is 128 rows, 2 is 96, 3 is 64, 4 is 48, 5 is 32 and 6 is 24. Draw it together with screen_contrast to get the whole effect.
TEXT_BULGE
The middle of the line stays full size and both the top and the bottom shrink away - like text on a barrel.
TEXT_DRUM
A lens fixed to the middle of the screen, and the words slide through it: full size in the middle, narrower and shorter toward the top and bottom of the lens, gone at its edge - like words printed on a drum that is rolling past you. Move the word up or down and it rolls. depth is how tight the lens is: 1 is as tall as the screen, 6 is tight.
TEXT_LEAN_BACK
The bottom of the line stays full size and the top shrinks away - like a sign tipped back, with its top edge farther from you.
TEXT_LEAN_FORWARD
The top of the line stays full size and the bottom shrinks away - like a sign tipped forward, with its bottom edge farther from you.
TILE_LOW_COVER
Blocks a body; a projectile passes over - duckable cover.
TILE_PASS
Blocks neither a body nor a projectile - open, walkable ground.
TILE_SOLID
Blocks both a body and a projectile - an ordinary wall.
WARP_DRIFT
A slow drift: one long, wide curve, like seaweed in a gentle current.
WARP_DRUNK
A drunken sway: slow, wide and a bit uneven, as if the sprite cannot stand up straight.
WARP_NONE
No warp: the sprite is drawn straight again.
WARP_SHAKE
A shake: every row jumps a little to one side or the other, as if the sprite had been hit.
WARP_SHIMMER
A heat shimmer: tiny quick ripples, like the air above a hot road.
WARP_WAVE
A wobble: the sprite sways left and right as you go down it, like something seen through water.
WARP_ZIGZAG
A zigzag: sharp points to the left and the right, like the edge of a saw.

Core

Core basics
The always-available calls that belong to no other category - a running frame counter, pausing the game, writing a note to the log, starting the game over, two ways to run an event by hand, and the frame profiler.
The frame profiler
A tool that measures where each frame's time goes, so you can find out why a game runs slow instead of guessing.
debug_watch
Shows a value on the screen while you test your game, so you can see it change without writing any drawing code: debug_watch("hp", hp). Each label gets its own row in the top-right corner. It only works in a Development Build: in the finished game (a Release Build) it shows nothing and costs nothing.
event_call
Runs an event right now. event_call(user0) runs this instance’s own User 0 event (n is 0-15); event_call(obj_name.user0) runs EVERY instance of obj_name’s; event_call(someRef.user0) runs ONLY the one instance someRef currently points at; event_call(parent) runs the parent’s version of the event you are in, then carries on with your own code.
every
True once every so many frames, and false the rest of the time: every(60) is true about once a second. Use it to spawn something every two seconds, blink, or tick a counter: if (every(120)) { instance_create(x, y, obj_enemy); }. The second number moves WHEN in the cycle it is true, so two things can fire apart.
game_frame
How many real frames have passed since this ROM booted - a plain, always-advancing counter, project-wide (not tied to any instance).
game_pause
Freezes or resumes the frame - Step Begin/Alarms/Buttons/Step/Movement/Step End stop running while paused, but Draw and the debug overlay keep running every frame regardless.
game_paused
True while the game is paused (see game_pause).
game_restart
Starts the whole game over, as if you had just switched the console on. Everything in the game's memory is thrown away, but what you saved with save_commit is kept.
log_write
Writes one line of text to the emulator's log, so you can see what your game is doing while you test it. To print a value, write it after the text: log_write("hp is", hp) writes "hp is 5". You can add as many values as you like.
profile_average
Like profile_percent, but averaged over the last 32 frames. It changes about twice a second, so it is steady enough to read.
profile_budget
How many CPU cycles one frame has: 280,896. Spend more than that in one frame and the game runs slow.
profile_cycles
The same as profile_percent, but counted in CPU cycles, the GBA's own tiny clock ticks, instead of a percentage.
profile_enabled
True if this game was built with the frame profiler switched on. When it is off, every profile_ number reads 0.
profile_name
The name of a phase, like "step" or "default sprites". An empty string if there is no such phase, or the profiler is off.
profile_percent
How much of one frame the last frame spent on this phase, as a percentage. 100 means one whole frame's worth of time.
profile_phases
How many phases a frame is split into - the jobs the game does every frame, like moving things or drawing sprites. 0 when the profiler is off.
profile_reset
Forgets the worst frames so far, so profile_worst starts counting again from nothing.
profile_worst
The most one frame has spent on this phase since the game started or profile_reset() was last called, as a percentage of one frame.

Cutscenes

Data Containers

Database

Device

Drawing

Drawing and the screen
A map of everything that decides what the player sees - sprites, text, backgrounds, the camera, effects and animated tiles - and which page covers which.
Screen anchors
An anchor names a spot on the screen, like the top-left corner, so a score or a health bar can say "4 pixels in from there" instead of hiding the size of the screen inside a number.
Drawing and the draw order
An instance draws its own sprite automatically until you write a Draw event, and after that you must call draw_self() yourself or it disappears.
Animations
Give an object named animations - which picture, which frames, how long each lasts, how it plays - then start one with animation_play("walk"). A frame can play a sound, send a named event, and carry attack, body and push boxes.
Depth groups - layers of drawing
Name layers of drawing in the Room Editor tab - ground, things, sky - and a whole layer is always drawn over the one before it. Inside a layer, things sort by depth or by how far down the screen they are.
Palettes - recoloring a picture
A picture remembers color numbers and a palette says which color each number is, so one picture can be drawn in many sets of colors - for one instance, one background, the room's tiles, text, particles or the zoomable background.
ANCHOR_BOTTOM_CENTER
Names the middle of the bottom edge of the screen, for draw_text_anchored, draw_text_warped_anchored, draw_text_3d_anchored, draw_rect_anchored and draw_rect_fill_anchored - the position you give them is measured from this spot.
ANCHOR_BOTTOM_LEFT
Names the bottom-left corner of the screen, for draw_text_anchored, draw_text_warped_anchored, draw_text_3d_anchored, draw_rect_anchored and draw_rect_fill_anchored - the position you give them is measured from this spot.
ANCHOR_BOTTOM_RIGHT
Names the bottom-right corner of the screen, for draw_text_anchored, draw_text_warped_anchored, draw_text_3d_anchored, draw_rect_anchored and draw_rect_fill_anchored - the position you give them is measured from this spot.
ANCHOR_CENTER
Names the exact center of the screen, for draw_text_anchored, draw_text_warped_anchored, draw_text_3d_anchored, draw_rect_anchored and draw_rect_fill_anchored - the position you give them is measured from this spot.
ANCHOR_MIDDLE_LEFT
Names the middle of the left edge of the screen, for draw_text_anchored, draw_text_warped_anchored, draw_text_3d_anchored, draw_rect_anchored and draw_rect_fill_anchored - the position you give them is measured from this spot.
ANCHOR_MIDDLE_RIGHT
Names the middle of the right edge of the screen, for draw_text_anchored, draw_text_warped_anchored, draw_text_3d_anchored, draw_rect_anchored and draw_rect_fill_anchored - the position you give them is measured from this spot.
ANCHOR_TOP_CENTER
Names the middle of the top edge of the screen, for draw_text_anchored, draw_text_warped_anchored, draw_text_3d_anchored, draw_rect_anchored and draw_rect_fill_anchored - the position you give them is measured from this spot.
ANCHOR_TOP_LEFT
Names the top-left corner of the screen, for draw_text_anchored, draw_text_warped_anchored, draw_text_3d_anchored, draw_rect_anchored and draw_rect_fill_anchored - the position you give them is measured from this spot.
ANCHOR_TOP_RIGHT
Names the top-right corner of the screen, for draw_text_anchored, draw_text_warped_anchored, draw_text_3d_anchored, draw_rect_anchored and draw_rect_fill_anchored - the position you give them is measured from this spot.
angle
Rotation in degrees (0 = east, counterclockwise). Any value works - it wraps automatically.
animation_current
The name of the animation this object is playing, like "walk", or an empty text if it is not playing one.
animation_ended_name
Inside an Animation End event: the name of the animation that just ended, like "attack". For an object that does not use named animations it is an empty text.
animation_event_name
Inside an Animation Event: the name you gave the event on the frame, like "swing". An empty text anywhere else.
animation_finished
True when the animation this object is playing was a play-once animation and has reached its last frame. Loops and back-and-forth animations are never finished.
animation_frame
Which frame of its animation this object is on, counting from 0 (the first frame in the Animations window). 0 when it is not playing one.
animation_play
Starts one of this object’s animations, by the name you gave it in the Animations window: animation_play("walk"). If that animation is already playing it keeps going, so you can call this every step. animation_play("attack", true) starts it over from its first frame, even if it is already playing.
animation_stop
Stops this object’s animation where it is. The picture stays on the frame it reached, and sprite, frame and frame_speed work by hand again.
bg_priority
Which of the four hardware layers everything this instance draws sits on, against BACKGROUNDS - 0 is closest to the viewer, 3 is furthest back, and 3 is the default. Separate from `depth`, which orders sprites against each other within one layer.
depth
Draw order: a HIGHER depth draws further back (drawn first, covered by anything with a lower depth). 0 is the default, already in front of anything pushed back on purpose.
draw_effect_start
Every picture and bar drawn from here until draw_effect_stop wears a sprite effect: draw_sprite, draw_rect_fill and draw_rect in a HUD or a menu pulse, wobble, tint or turn the way an object would. It is ambient, like text_effect_start is for words. Call it every frame, in a Draw GUI event or in a script one calls, before the draw calls it should reach.
draw_effect_stop
Pictures and bars are drawn plainly again from here. Use it to keep the next draw call plain after one that wears an effect. It does nothing when no effect is chosen.
draw_rect
Draws a 1-pixel-thick, axis-aligned outline (never filled) w wide and h tall, with its top-left corner at (x, y) - world space, scrolling with the camera the same way draw_rect_fill does. Inside a Draw GUI event it is fixed to the screen instead, and (x, y) counts from the screen’s top-left pixel.
draw_rect_anchored
draw_rect, but the position is measured from a spot on the screen (ANCHOR_TOP_CENTER, ANCHOR_CENTER, ...) instead of from the top-left corner, and it is fixed to the screen wherever you call it - a selection frame or a border that stays put on any screen.
draw_rect_fill
Draws a filled, axis-aligned rectangle w wide and h tall, with its top-left corner at (x, y) - world space (the shared camera is attached, same as draw_sprite). So draw_rect_fill(x, y, 10, 4, c) covers x to x + 10 across and y to y + 4 down. Inside a Draw GUI event it is fixed to the screen instead, and (x, y) counts from the screen’s top-left pixel, so draw_rect_fill(0, 0, screen_width(), screen_height(), COLOR_BLUE) fills the whole screen. A real sprite, not paint: see the "On the GBA" note for exactly what that costs.
draw_rect_fill_anchored
draw_rect_fill, but the position is measured from a spot on the screen (ANCHOR_BOTTOM_LEFT, ANCHOR_CENTER, ...) instead of from the top-left corner, and it is fixed to the screen wherever you call it - a health-bar backing pinned to a corner stays pinned to it on any screen.
draw_self
Draws this instance using its own sprite/frame/angle/scale/flip/depth fields, exactly the way default drawing already would - callable from inside a custom Draw event to keep the default appearance while adding extra draw_sprite/draw_text calls around it. Inside a Draw GUI event it draws on the screen instead, with x and y read as a place on the screen.
draw_sprite
Draws a sprite at (x, y) with a specific frame - world space (the shared camera is attached, same as default drawing). Inside a Draw GUI event it is fixed to the screen instead, and (x, y) counts from the screen’s top-left pixel.
draw_sprite_3d
Like draw_sprite, but the picture curves away from you, as if it were wrapped round a barrel or tipped back like a sign: the top and bottom of it shrink back and the middle stays full size. shape picks the look: SPRITE_BULGE, SPRITE_LEAN_BACK and SPRITE_LEAN_FORWARD choose which part of the picture shrinks, and SPRITE_DRUM fixes a lens on the middle of the screen and the sprite slides through it. depth says how much, from 1 to 3 (1 is gentle, 3 is deep); for SPRITE_DRUM it is how tight the lens is, from 1 to 6. 0 draws the sprite flat.
draw_sprite_3d_scaled
draw_sprite_3d at any size: xscale and yscale make the picture wider and taller (or smaller) the way they do in draw_sprite_scaled, and the curve grows with it, so a depth means the same thing at any size. shape and depth work exactly as they do in draw_sprite_3d. A negative xscale or yscale flips the whole picture, curve and all (a yscale of -1 is a reflection).
draw_sprite_ripple
Like draw_sprite, but the picture sways left and right as you go down it, like something seen through water. size is how far it sways (1 to 4 pixels each way), length is how many rows from one ripple to the next (16, 32 or 64) and speed is how fast the ripples travel down the screen.
draw_sprite_scaled
Like draw_sprite, with rotation, scale, flips and an explicit depth (quantised the same way the depth instance variable is).
draw_sprite_sheared
Like draw_sprite_scaled, with the picture leaned as well: xshear slides its top sideways and yshear lifts one side, the same numbers the xshear and yshear instance variables take.
flip_x
Mirrors the sprite left-right. Combines with a negative xscale by XOR, not by overriding it - both true at once cancels back to unmirrored.
flip_y
Mirrors the sprite top-to-bottom. Combines with a negative yscale by XOR, not by overriding it - both true at once cancels back to unmirrored.
frame
Which frame of `sprite` is shown. Reading it gives the frame on screen; a number outside 0..frame_count-1 is clamped to the nearest frame that exists (so 3 on a 2-frame sprite shows the 2nd frame).
frame_count
How many frames `sprite` has. 0 if no sprite is set.
frame_speed
How many frames `frame` advances per game frame. 0 (the default) does not animate; 1 is one frame every game frame (60 a second); 0.5 is one every other game frame. Runs back to frame 0 by itself after the last frame (the sprite knows how many it has) and fires Animation End. Set `frame` any time to jump to a frame.
palette_color
A color of a palette you already have, to draw a rectangle in: palette_color(hud_colors, 5) is the color in the sixth place (slot 5, counting from 0) of the palette hud_colors. Use it where a COLOR_ name goes: draw_rect_fill(10, 10, 40, 6, palette_color(hud_colors, 5)). slot is 0 to 15.
screen_height
How many pixels tall the screen is - ask for it instead of typing a number, so a game keeps working on a screen of a different size.
screen_width
How many pixels wide the screen is - ask for it instead of typing a number, so a game keeps working on a screen of a different size.
show_collision
Draws a 1-pixel-thick red outline around this instance's own collision mask (the real box pos_free/move_slide/etc test against, not its sprite's bounds) when on is true - draws nothing when it is false or this is never called.
show_collision_all
Same as show_collision, but for every live instance of every object type at once - a single project-wide switch, not tied to whichever instance calls it.
sprite
The sprite this instance is drawn with. Set to nothing-equivalent (leave unset) to draw nothing.
sprite_blocky
Marks everything this object draws as blocky, or takes the mark off, so a look from screen_mosaic can turn it into big square blocks: a hero that comes into focus. on is true to mark it and false to take the mark off. With no mosaic look on, a marked object looks just the way it did.
sprite_color_look
Gives ONE color of a sprite a different color on every row of the screen, so a flame can run from yellow to red or a crystal from white to blue. EVERY picture that uses that color changes, not only one object. spr is the sprite, color_number is which of its colors (1 and up), look is one of the SPRITECOLOR_ constants, strength (1 to 3) is how rich the colors are, and speed is how fast they slide down the screen. SPRITECOLOR_NONE turns it off.
sprite_distort
Draws this object’s picture narrower on some rows, so it looks like a barrel, an hourglass, a sign tipped away from you or a wobbling jelly. look is one of the DISTORT_ constants, strength (1 to 3) is how much narrower the narrowest row is, and speed is how fast a DISTORT_WAVE travels down the picture (the other looks ignore it). DISTORT_NONE turns it off.
sprite_effect_active
True while a sprite effect is playing on this object. An effect whose tracks all pulse once is over after its last frame.
sprite_effect_change
Changes the sprite effect playing on this object into another one over so many frames. A frozen tint turns into a burning one, a gentle wobble turns into a dizzy one. sprite_effect_change(nothing, frames) fades the effect away and then stops it; with no effect playing, the new one fades in. With frames at 0 it happens at once, like sprite_effect_start and sprite_effect_stop. Call it from the object’s own event, once.
sprite_effect_speed
Sets how fast the Wobble and the Distort of a sprite effect go on this object, from 0 to 400 percent (100 is the effect as you made it; 50 half as fast, 200 twice as fast, 0 stands still where it is). The percent multiplies the Speed of both tracks. It does not change how long a pulse takes or how strong the effect is (sprite_effect_strength does that). Call it from any event, a Step event included. It does nothing when effect is not the effect playing on this object.
sprite_effect_speed_get
The speed, in percent, of a sprite effect playing on this object: 100 when it is not playing or its speed was never set.
sprite_effect_start
Plays a sprite effect on this object only: a hit flash, a freeze tint, a dizzy wobble, a ghost. A sprite effect is made in the Overlay Effects tab, like a screen effect, but it changes one object instead of the whole screen. Starting another one on the same object replaces the first. sprite_effect_start(nothing) stops it.
sprite_effect_stop
Stops the sprite effect playing on this object, if there is one, and puts the object back the way it was. It does nothing when no sprite effect is playing on it.
sprite_effect_strength
Sets how strong a sprite effect plays on this object, from 0 to 100 percent (100 is the effect as you made it). The percent multiplies the strength of every track, on top of the track’s own way of moving: a pulse still rises and falls as it was made, only less far; 0 shows nothing. Call it from any event, a Step event included: change the number a little each frame (tween_to does it for you) and the effect fades in, reaches full strength and settles down to nothing. It does nothing when effect is not the effect playing on this object.
sprite_effect_strength_get
The strength, in percent, of a sprite effect playing on this object: 100 when it is not playing or its strength was never set.
sprite_frames
How many animation frames a sprite asset has. The asset-level twin of frame_count below: frame_count always answers for whichever sprite THIS instance currently shows; sprite_frames answers for any sprite asset you name, including one this instance is not showing, or never shows at all.
sprite_height
The height of a sprite asset, in pixels — the same size the editor’s art already has for spr itself, whether or not any instance is currently showing it.
sprite_origin_x
The x pixel of a sprite asset’s own origin, measured from its top-left — the point default drawing, draw_sprite/draw_sprite_ext/draw_self, and instance_create all treat as “where this sprite is”. Unset (no origin authored in the Sprites tab) answers the sprite’s own center, exactly where it drew before this existed.
sprite_origin_y
The y pixel of a sprite asset’s own origin, measured from its top-left (of a single animation frame — a multi-frame sheet’s origin applies to every frame alike). Same rule as sprite_origin_x: unset answers the sprite’s own center.
sprite_palette
Draws this instance in the colors of a palette instead of its sprite’s own colors. Only the instance that calls it changes: another copy of the same object keeps its colors. sprite_palette(nothing) puts the sprite’s own colors back.
sprite_see_through
Marks everything this object draws as see-through, or takes the mark off, so a look from screen_blend decides how much of it shows on each row: a ghost that fades away toward its feet. on is true to mark it and false to take the mark off. With no blend look on and no dark room, a marked object looks just the way it did.
sprite_warp
Moves this object’s picture sideways by a different amount on every row, so it wobbles like something seen through water. look is one of the WARP_ constants, strength (1 to 3) is how far it moves, and speed is how fast the pattern travels down the picture. WARP_NONE turns it off.
sprite_width
The width of a sprite asset, in pixels — the same size the editor’s art already has for spr itself, whether or not any instance is currently showing it.
visible
Whether the engine draws this instance for you (true by default). Only that automatic drawing checks it - an object with its own Draw event keeps drawing when `visible` is false, so write `if (visible) { draw_self(); }` yourself.
xscale
Horizontal scale. 1 is normal size. Negative mirrors it, the same visual result flip_x gives.
xshear
How far the picture leans sideways. 0 is upright; a positive number slides the top to the right (and the bottom to the left), like italic writing. It is how many pixels the top slides for every pixel of height, so 0.5 on a sprite 32 pixels tall puts the top 8 pixels right of the middle.
yscale
Vertical scale. 1 is normal size. Negative mirrors it, the same visual result flip_y gives.
yshear
How far the picture tilts up or down along its width. 0 is level; a positive number lifts the right edge (and drops the left), like a flag pulled up at one end. It is how many pixels the right side rises for every pixel of width.

Effects

Effects
Particle systems and lights are the two effects you control from code, and both are built from real sprites, so both spend from the same hardware budgets as everything else.
Room lighting
Lights and lit objects, set up in Gbabel's Lighting setting: a light cuts a hole in a room's darkness and tints what stands in it, with no code at all.
effect_burst
Spawns one one-shot burst of a particle system at (x, y) - a hit spark, a puff of dust, a splash. Fire-and-forget: the burst finishes and cleans itself up, so there is no handle and nothing to stop.
effect_palette
Draws the particles of a particle system in the colors of a palette instead of its sprites’ own colors, from now on: every burst and every running copy of that system, whoever started it. effect_palette(sys, nothing) puts the sprites’ own colors back.
effect_start
Starts a particle system running at (x, y) - a torch, a smoking wreck, a waterfall - and keeps it running for as long as the instance that started it exists. It belongs to that instance: destroy the instance, leave the room or restart it, and the system stops by itself. There is no handle to keep and nothing to forget.
effect_start_room
Like effect_start, but the ROOM owns the system instead of the instance: it keeps running after the instance that started it is destroyed, and stops when the room changes or restarts.
effect_stop
Stops the running particle system `sys` that this instance started (or that the room is running with effect_start_room), and gives its slot back at once. Particles already in the air finish their own lives rather than vanishing mid-flight.
light_flicker
Makes this object’s light waver like a flame (true) or hold steady like a lamp (false). Flicker is also a choice in Gbabel; this changes it while the game runs. It does nothing on an object that is not set as a light.
light_on
Switches this object’s light on or off. An object set as a light in Gbabel (Lighting: This is a light) starts on; off, it cuts no hole in a shroud and lights nothing. It does nothing on an object that is not set as a light.
light_rotate
Points this object’s light: `angle` is in degrees, 0 is east and it turns counterclockwise, the same as this instance’s own `angle` (so 270 is down). The Rotation set in Gbabel is where the light starts. It does nothing on an object that is not set as a light.
light_scale
Makes this object’s light bigger or smaller: `scale` multiplies the size set in Gbabel (1 is as set, 2 twice as far and as wide, 0.5 half, 0 as good as off). The light grows and shrinks about its own origin, which never moves. It does nothing on an object that is not set as a light.
shroud_cutout
Makes this instance a light source: it cuts a hole `radius` pixels across in the current room’s shroud, wherever it stands, optionally flickering rather than holding steady.
shroud_cutout_sprite
Makes this instance a light source whose hole is the SHAPE of a sprite you supply, scaled by `scale` - the general form of shroud_cutout, which is just this with a built-in circle. The form without an angle - see shroud_cutout_sprite_angle to also turn the hole.
shroud_cutout_sprite_angle
Like shroud_cutout_sprite, but the hole can also be turned: `angle` rotates the mask in place, in degrees - 0 is east, turning counterclockwise, the same convention this instance’s own `angle` already uses.

Engine

Events

When each event runs
Every event GBML has, in the order the game runs them during one frame, with a link to the page for each.
animation_end
Runs the frame `frame` wraps past `sprite`’s last frame back to the start.
animation_event
Runs when an animation of this object reaches a frame that has a named event (set in the Animations window, for a footstep, a swing, a spawn point). Inside it, animation_event_name is the name you gave the event.
attack_hits
Runs when one of this object’s attack boxes (drawn in the Animations window, on the frame it is showing) touches a body box of an instance of the target object. Inside it, `other` is the instance that was hit. It fires once for each instance hit in each play of the animation, not every frame the boxes touch.
beyond_room
Runs every frame this instance’s position has left the current room’s own bounds entirely.
beyond_view
Runs every frame this instance’s position is outside the camera’s current 240x160 view - the exact rect, no margin (unlike default drawing’s own off-view sprite-release test, which pads it).
button
Runs for one of the ten buttons, on one of three phases: Pressed (the frame it went down), Held (every frame it stays down), Released (the frame it went up).
cleanup
Runs once, when the instance’s slot is actually freed - after Destroy (end of the same frame), or when a non-persistent instance is cleared on a room change.
collision
Runs once for each instance of the target object this instance overlaps, after every collision in the frame has been found first. Inside it, `other` is the instance that was hit.
create
Runs once, when the instance is made, after its variables are set (S2.9).
destroy
Runs once, when this instance is destroyed - immediately, not at the end of the frame (S2.6).
draw
Runs every frame, in world space. An object with no Draw event gets its sprite drawn automatically, every frame, for free. Adding a Draw event turns that off for this object - call draw_self() first if you still want the normal look, then draw whatever else you want on top of or instead of it.
draw_begin
Runs every frame, in world space, before Draw. If this object has no Draw event of its own, its sprite is drawn automatically right after Draw Begin, so anything drawn here still lands underneath it - but once this object defines Draw, that automatic drawing stops happening at all, so there is nothing left for Draw Begin to run "before" except Draw itself.
draw_end
Runs every frame, in world space, after Draw.
draw_gui
Runs every frame, fixed to the screen - for a HUD. Everything drawn in it (draw_text, draw_sprite, draw_rect_fill, any draw call, even one made from a script it calls) is on the screen layer: it counts from the screen’s top-left pixel, never scrolls with the camera, and sits on top of the room, the shroud and every sprite in the world.
draw_gui_begin
Runs every frame, fixed to the screen, before Draw GUI - a natural place for a HUD backdrop panel. Everything drawn in it is on the screen layer: it counts from the screen’s top-left pixel, never scrolls with the camera, and sits on top of the room. Running earlier does not by itself draw behind Draw GUI - depth decides that.
draw_gui_end
Runs every frame, fixed to the screen, after Draw GUI - a natural place for a screen-fixed cursor or tooltip. Everything drawn in it is on the screen layer: it counts from the screen’s top-left pixel, never scrolls with the camera, and sits on top of the room. Running later does not by itself draw on top of Draw GUI - depth decides that.
game_start
Runs once, for every instance placed in the very first room, right after that room’s instances are placed - BEFORE that room’s own creation code, and before Room Start (S2.10’s own order: place → Game Start → the room’s creation code → Room Start).
hit_room_edge
Runs every frame this instance’s position is at or past the room’s boundary on some axis (a superset of Beyond Room - includes standing exactly on the edge).
inside_view
Runs once, the frame this instance’s position crosses from outside the camera’s current 240x160 view to inside it - never again while it stays inside. An instance already inside the view the first time it is ever checked (created there, or placed there by its own room) counts that first check as its one arrival.
path_end
Runs when this instance reaches the end of its current path - once for PATH_STOP/PATH_CONTINUE, every lap for PATH_LOOP, every bounce for PATH_PING_PONG (path_start’s own end_action decides which).
region_enter
Runs once, for every instance of this object, when the player arrives in a different region of a world than the last one they were in. Inside it, region_current() is the region just entered and region_previous() the one that was left. It also runs once when the game starts, for the region the player starts in.
region_exit
Runs once, for every instance of this object, when the player leaves a region of a world by arriving in another. Inside it, region_previous() is the region that was left and region_current() the one just entered. It runs just before Region Entered, and not when the game starts, because nothing was left then.
room_end
Runs once, as the room this instance is in stops being current - every non-persistent instance is then cleared before the next room loads.
room_start
Runs once, for every instance in a room (including ones placed by the room itself), right after the room’s own creation code runs, when that room becomes current.
step
Runs every unpaused frame, after alarms and button events, before movement (S2.10 step 4).
step_begin
Runs every unpaused frame, before alarms and button events (S2.10 step 1).
step_end
Runs every unpaused frame, after movement, the room-edge/view checks and the collision step (S2.10 step 8).
user
Runs when event_call(userN) (n is 0-15) names this instance - directly, via event_call(userN) from inside its own code, or because event_call(ObjectType.userN) named every instance of its object, this one included. See event_call for the two call shapes.

Grids

Grids
grid is a fixed-size 2-D container, indexed by column and row - a board, a tilemap, or anything else that is naturally rows and columns.
grid_copy
Makes a new grid that is a copy of source: the same width and height, every cell holding what it holds in source. Changing the copy never changes source, and the other way round. It goes on the right-hand side of the line that makes the variable, like grid_create, and it costs a whole second grid of memory.
grid_create
Makes a grid of width columns and height rows, every cell starting as fill. The kind of grid follows from fill: grid_create(8, 6, 0) is an 8-wide, 6-tall grid. width and height must be whole numbers written right there in the code.
grid_fill
Sets every cell of target to value. A grid is always full, so there is nothing to grow: the grid keeps its width and height and every cell becomes value. It works on a grid handed to a script too.
grid_fill_region
Sets a block of cells of target to value: every cell from column x1, row y1 across and down to column x2, row y2, both corners included, so (1, 1) to (3, 2) is 3 cells wide and 2 tall. A block with its corners the wrong way round (x2 less than x1, or y2 less than y1) is empty and changes nothing. A block that runs off the grid is cut to the grid. Typing a corner that is off the grid, or the corners the wrong way round, is refused when the project is checked.
grid_filter
Makes a new LIST of just the cells of target that the script test says yes to, going row by row from the top left, in that order. test is the NAME of one of your scripts; it takes one argument (the cell's value) and gives back true or false. The answer is a list, not a grid: the cells that pass no longer have places to sit in. target is not changed.
grid_foreach
Runs the script action once for each cell of target, handing it that cell's value. The cells come row by row: the whole top row from left to right, then the next row down, and so on. action is the NAME of one of your scripts and it must take exactly one argument.
grid_get_region_max
Finds the biggest cell in a block of target - from column x1, row y1 to column x2, row y2, both corners included - and gives its value. A block of only negative numbers gives the biggest of them, not 0. A block with nothing in it gives 0. A grid of text, yes-or-no values or structs is refused when the project is checked.
grid_get_region_mean
Gives the average of the cells in a block of target - from column x1, row y1 to column x2, row y2, both corners included. On a grid of whole numbers the answer is a whole number and it TRUNCATES: the part after the point is dropped, toward zero, so the average of 1 and 2 is 1 and the average of -1 and -2 is -1. On a grid of decimals the answer keeps its fraction. A block with nothing in it gives 0. A grid of text, yes-or-no values or structs is refused when the project is checked.
grid_get_region_sum
Adds up the cells in a block of target - from column x1, row y1 to column x2, row y2, both corners included - and gives the total, as a whole number for a grid of whole numbers and a decimal for a grid of decimals. A block with nothing in it adds up to 0. A grid of text, yes-or-no values or structs is refused when the project is checked. A total too big for the kind stops at the biggest (or smallest) number it can hold instead of wrapping round.
grid_height
How many rows target has - the second number grid_create(width, height, fill) was given, so the y in target[# x, y] runs from 0 up to one less than this. It is worked out when the game is built, so it costs nothing while the game runs.
grid_shuffle
Mixes up the cells of target, in place: afterwards every cell holds one of the values the grid held before, in a random place. Cells move one at a time, so a row or a column does not stay together (use grid_shuffle_rows or grid_shuffle_columns for that). It makes no copy.
grid_shuffle_columns
Mixes up the order of the columns of target, in place. Each column moves as a whole, so the cells of a column stay together and in the same order top to bottom; only which column comes first, second and so on changes. It makes no copy.
grid_shuffle_rows
Mixes up the order of the rows of target, in place. Each row moves as a whole, so the cells of a row stay together and in the same order left to right; only which row comes first, second and so on changes. It makes no copy.
grid_sort
Sorts the values along each column of target when column is true, top to bottom, or along each row when column is false, left to right. ascending picks smallest first (true) or biggest first (false). EACH column or row is sorted on its own, so the cells of a row do not stay together: a name and its score can end up apart (grid_sort_rows is the one that keeps rows whole). The cells must hold numbers or text.
grid_sort_rows
Puts the ROWS of target in order by the value each one has in one column, and keeps every row together: the cells of a row move as a whole, so a name stays beside its score. by_column says which column to look at (0 is the left-most) and ascending picks smallest first (true) or biggest first (false). Rows that have the same value in that column stay in the order they were in. The grid must hold numbers or text, and the value in that column is what is compared. It changes target itself and makes no copy.
grid_width
How many columns target has - the first number grid_create(width, height, fill) was given, so the x in target[# x, y] runs from 0 up to one less than this. It is worked out when the game is built, so it costs nothing while the game runs.

Input

Reading the buttons
Every frame the game can ask each of the ten GBA buttons whether it was just pressed, is being held, or was just released, and those three answers are different things.
action_held
True this frame if the named action is held down (see btn_held for the raw-button equivalent). The action is one of the names in your project’s Project Settings, written as a plain word: `action_held(jump)`.
action_pressed
True this frame if the named action is pressed (the frame it went down) (see btn_pressed for the raw-button equivalent). The action is one of the names in your project’s Project Settings, written as a plain word: `action_pressed(jump)`.
action_rebind
Makes the action mean one button from now on - the way a controls screen lets a player choose. It replaces every button the action had, so afterwards only `b` counts.
action_released
True this frame if the named action is released (the frame it went up) (see btn_released for the raw-button equivalent). The action is one of the names in your project’s Project Settings, written as a plain word: `action_released(jump)`.
action_reset
Puts the action back to the buttons Project Settings gave it, undoing any action_rebind() of it.
btn_buffered
True if button b went down this frame or in any of the frames just before: btn_buffered(BTN_A, 6) is true for 6 frames after A was pressed. It makes a jump forgiving: if the player taps A a moment before landing, the jump still happens when they land.
btn_dx
The d-pad’s horizontal axis: -1 (Left), 0, or 1 (Right). Both held at once cancels to 0. Add a player number from 1 to 4 to ask another controller: btn_dx(2).
btn_dy
The d-pad’s vertical axis: -1 (Up), 0, or 1 (Down). Both held at once cancels to 0. Add a player number from 1 to 4 to ask another controller: btn_dy(2).
btn_held
True this frame if button b is held down. Add a player number from 1 to 4 to ask another controller: btn_held(BTN_A, 2). Without one it is player 1.
btn_held_frames
How many frames in a row button b has been held down, counting this one: 0 while it is up, 1 on the frame it goes down, 2 on the next. Use it for a charge shot (fire when it reaches 60 and the button comes up) or a long press.
btn_pressed
True this frame if button b is pressed (the frame it went down). Add a player number from 1 to 4 to ask another controller: btn_pressed(BTN_A, 2). Without one it is player 1.
btn_released
True this frame if button b is released (the frame it went up). Add a player number from 1 to 4 to ask another controller: btn_released(BTN_A, 2). Without one it is player 1.

Instances

Objects and parents
How one object can be built on another, what a child gets for free, why writing an event yourself replaces the parent's, and how event_call(parent) gives you both.
alarm
A countdown, in frames: set alarm[n] (n is 0-11) to a frame count, and the matching Alarm n event runs the frame it reaches exactly 0.
id
A number that uniquely identifies this instance.
instance_count
How many instances of `obj` are alive right now, counting its children too. Name more objects after the first and it adds them all up: instance_count(obj_orc, obj_bat) is the orcs and the bats together.
instance_create
Creates a new instance of `obj` at (x, y) and returns a reference to it, or nothing if that object’s pool is already full.
instance_destroy
Destroys an instance - at the end of the current frame. The instance finishes the frame first (the rest of its events run, and other instances still find it); then its Destroy event runs, once, and it is removed.
instance_exists
True if a reference still points at a live instance.
instance_furthest
The instance of `obj` furthest from (x, y) by straight-line distance, or nothing if none are alive. If `obj` is a parent, its children count as `obj`.
instance_max
The most instances of `obj` that can ever exist at the same time. Fixed when the game is built - it never changes while the game is running.
instance_nearest
The instance of `obj` closest to (x, y) by straight-line distance, or nothing if none are alive. If `obj` is a parent, its children count as `obj`.
instance_nth
The instance of `obj` at number n, counting from 0, or nothing if n is below 0 or there are not that many. If `obj` is a parent, its children count as `obj`.
object
Which object this instance is an instance of.
persistent
Whether this instance survives a room change instead of being cleared with the rest of the old room.
x
This instance’s current horizontal position, in pixels.
xprev
Where x was at the start of this frame’s movement step, before this frame’s motion was applied.
xstart
Where x was when this instance was created - never changes afterward.
y
This instance’s current vertical position, in pixels.
yprev
Where y was at the start of this frame’s movement step, before this frame’s motion was applied.
ystart
Where y was when this instance was created - never changes afterward.

Language

The GBML language
A map of the language pages - what each one is about, and the order that makes the most sense to read them in.
What GBML is
An event-driven scripting language for the Game Boy Advance, compiled ahead of time to C++.
Where (0, 0) is
Every position in GBML is counted from a top-left corner - of the screen, of the room, of the camera's view or of a background's picture - so (0, 0) is always a top-left corner.
Variables, types and scope
A variable has exactly one type, decided the first time it is assigned, and one of four places it can live.
Writing a type out, instead of in a comment
Every job a /// tag does - the type of a variable, how big a list or string is, what a script takes and gives back - can also be written as normal code; this page lists both ways side by side.
Expressions and statements
The operators, control flow and the with statement that let one line of code reach into another instance.
Functions
Named functions, default parameters, and the function you can write in place for foreach, filter and keep.
Structs and constructors
A struct is a fixed-shape bundle of values, and it compiles today. A constructor is meant to build one automatically - that part still does not. See what to use today.
Objects and instances
An object is what you design; an instance is one of it that exists right now, with the variables the engine already gives it.
Events
The named moments the engine calls into your object's code, from Create through Draw GUI.
The order of a frame
The exact sequence every frame runs in, from Step Begin to the frame being shown.
What is unavailable, and why
Every deliberate gap in GBML, the hardware or toolchain reason behind it, and what to use instead.
Where the machine shows through
The places GBML is honest about running on real GBA hardware instead of hiding it behind an abstraction.

Link Cable

The link cable
Two Game Boy Advances joined by a link cable can share their buttons, so a game can have a second player on a second console - and it carries on safely when the cable is not there.
link_button_held
True this frame if player `player` (1 to 4) has button `b` held down - the same question as btn_held, about any player on the link cable. Asking about your own player number reads your own buttons, so one piece of code can serve every player. A player who is not there, or a number that is not a player, is simply false.
link_button_pressed
True this frame if player `player` (1 to 4) has button `b` pressed (the frame it went down) - the same question as btn_pressed, about any player on the link cable. Asking about your own player number reads your own buttons, so one piece of code can serve every player. A player who is not there, or a number that is not a player, is simply false.
link_button_released
True this frame if player `player` (1 to 4) has button `b` released (the frame it went up) - the same question as btn_released, about any player on the link cable. Asking about your own player number reads your own buttons, so one piece of code can serve every player. A player who is not there, or a number that is not a player, is simply false.
link_connected
True while at least one other console is playing with this one. It turns true shortly after both consoles have called link_start(), and false again if no message has arrived for half a second - the cable was pulled, the other console was switched off, or it left the two-player part of the game.
link_dx
The horizontal axis of a player’s d-pad, like btn_dx but for any player on the link cable: -1 (Left), 0, or 1 (Right). Both held at once cancels to 0, and a player who is not there is 0.
link_dy
The vertical axis of a player’s d-pad, like btn_dy but for any player on the link cable: -1 (Up), 0, or 1 (Down). Both held at once cancels to 0, and a player who is not there is 0.
link_missed
How many frames of the other players’ buttons never reached this console since they were first heard. A healthy cable keeps this at or near 0. Draw it on the screen while you test: if it climbs, two consoles are drifting apart.
link_player
Which player this console is: 1 to 4. It is 0 until another console has been heard, because a console only learns its place on the cable from the first message it receives. Players are numbered 1 to 4 by where they sit on the cable, and player 1 is the console with the cable’s small purple plug in it.
link_players
How many consoles are playing, counting this one: 0 while the link is off, 1 when it is on and nobody else has been heard, up to 4 with a four-way cable.
link_start
Turns the link cable on. From the next frame this console sends its own buttons to every console on the cable and listens for theirs. Calling it again while it is on does nothing, so it is safe to call from a Create event or every frame.
link_stop
Turns the link cable off and forgets everyone: link_connected() is false and every other player’s buttons read as not pressed. Use it to leave a two-player game for a one-player one.

Lists

Lists
list is a row of items that grows and shrinks while the game runs - add to the end, remove from anywhere, up to a size you choose when you declare it.
list_add
Adds value to the end of target. Returns true if it fit, false if target was already full (nothing is added - target never crashes or corrupts, it just stops growing).
list_clear
Removes every item from target, leaving it empty (list_length(target) becomes 0). target's own declared capacity is unchanged - it can be filled again afterward.
list_contains
True if any item in target equals value, false otherwise (including when target is empty).
list_copy
Makes a new list that is a copy of source: the same items in the same order, and the same capacity (the most it can hold), whatever source holds right now. Changing the copy never changes source, and the other way round. It goes on the right-hand side of the line that makes the variable, like list_create, and it costs a whole second list of memory.
list_create
Makes an empty list that can hold up to capacity items. example is any value of the kind it will hold - list_create(16, 0) is a list, list_create(8, "") a list - and is never put in the list. Write the example as the kind you want: 0 is whole numbers and 0.0 is decimals, and a decimal does not fit in a list of whole numbers later (a `/// @type {list}` comment above the line makes it decimals whatever the example is). capacity must be a whole number written right there in the code.
list_create_fill
Makes a list that can hold up to capacity items and fills it right away: it ends up with capacity items, every one of them value. It is list_create followed by list_fill, in one line. Unlike list_create, the value you give is really put in - it is not just an example. The value also decides what kind of list it is: list_create_fill(13, 0) holds whole numbers and list_create_fill(13, 0.0) holds decimals. A whole number fits in a list of decimals but a decimal does not fit in a list of whole numbers, so write 0.0 if the list will ever hold a decimal (an answer from lerp, say). A `/// @type {list}` comment above the line also makes it decimals. capacity must be a whole number written right there in the code.
list_fill
Fills target right up to its capacity, with every place holding value. Afterwards list_length(target) is the same as its capacity, so target[i] works for every place from 0 up to the last one. Anything that was in target is replaced. A list made with list_create starts empty, so this is the way to fill it.
list_filter
Makes a new list of just the items of target that the script test says yes to, in their original order. test is the NAME of one of your scripts; it takes one argument and gives back true or false. The new list has the same capacity as target (the most it could ever hold). target is not changed.
list_find
Gives back the place (the index; 0 is the first item) of the first item in target that equals value, or -1 if value is not in target at all. If you only want to know yes or no, list_contains does that.
list_foreach
Runs the script action once for each item in target, from the first to the last, handing it that item. action is the NAME of one of your scripts and it must take exactly one argument. It is the same as writing a loop over target that calls the script with target[i].
list_insert
Puts value into target at index (0 is the first place), and everything from there on shifts one place towards the end. Returns true if value went in, false if index was out of range (target is left unchanged). If target is already full, the last item falls off the end and is lost - on purpose, with no error.
list_keep
Keeps only the items of target that the script test says yes to, and takes out the ones it says no to - in the list itself, with no second list made. The items that stay keep their order. test is a script that takes one argument (the item) and gives back true or false: the same kind of script list_filter uses, where true means keep. Do not add to or take from target inside that script.
list_length
How many items target currently holds - 0 for an empty list, up to target's own declared capacity once it is full.
list_max
Gives back the biggest number target holds: list_max(scores) of 7, 3 and 9 is 9. Use it for the best score or the tallest tower.
list_min
Gives back the smallest number target holds: list_min(scores) of 7, 3 and 9 is 3. Use it for the lowest cooldown or the shortest distance.
list_pop
Removes the LAST item of target AND gives it back to you. If target is empty, nothing is removed and a plain default value comes back instead (0, 0.0, false, an empty string or `nothing`, depending on what the list holds) - target never crashes. Check list_length(target) first if you need to tell "the last item really was this" apart from "the list was empty".
list_remove
Removes the item at a POSITION in target - not a value. list_remove(l, 0) removes the FIRST item, whatever it is; it does not look for an item equal to 0. (list_add takes a value, so these two read alike but do not match.) Returns true if it removed something, false if the position was out of range (target is left unchanged). Everything after the removed item shifts down one place, so target stays in order.
list_reverse
Turns the order of the items in target around, in place: the first item becomes the last and the last becomes the first. It changes target itself and makes no copy. Any kind of item can be reversed, text included.
list_shuffle
Mixes up the order of the items in target, in place: afterwards it holds the same items in a random order. It makes no copy. Any kind of item can be shuffled, text included.
list_sort
Puts the items of target in order. Numbers go smallest first when ascending is true and biggest first when it is false. Text goes in alphabetical order when ascending is true (Z to A when it is false), with one catch: every capital letter comes before every small letter. It changes target itself and makes no copy. A list of yes-or-no values, structs or references is refused when the project is checked.
list_sort_by
Puts the items of target in order by a number YOU work out for each one. key is the NAME of one of your scripts; it takes one argument (the item) and gives back a number. With ascending true the item with the smallest number comes first; with false the biggest first. Unlike list_sort it works on lists of structs and references, so "nearest enemy first" or "highest score first" is one line: list_sort_by(enemies, distance_to_player, true).
list_sum
Adds up all the numbers target holds: list_sum(gold) of 5, 10 and 20 is 35. Use it for the total gold, damage or points.

Maps

Maps
map stores values under keys instead of positions - ask for "alice" and get alice's score, no matter where in the container it sits.
map_clear
Removes every key/value pair from target, leaving it empty (map_length(target) becomes 0). target's own declared capacity is unchanged - it can be filled again afterward.
map_copy
Makes a new map that is a copy of source: the same keys with the same values, and the same capacity. Changing the copy never changes source, and the other way round. It goes on the right-hand side of the line that makes the variable, like map_create, and it costs a whole second map of memory.
map_create
Makes an empty map that can hold up to capacity pairs. key_example and value_example are any values of the kinds it will hold - map_create(16, "", 0) is a map, text keys with number values - and are never put in the map. capacity must be a whole number written right there in the code, and a power of two (2, 4, 8, 16, 32...).
map_get
Reads the value stored at key in target, a map. If key is not present, nothing is changed and a plain default value is returned instead (0/0.0/false/an empty string/`nothing`, depending on V) - target never crashes. Check map_has(target, key) first if you need to tell "key really maps to this value" apart from "key was not present".
map_has
True if key is currently present in target, false otherwise. The way to know, BEFORE calling map_get, whether the value it would give back is real or just the missing-key default.
map_length
How many key/value pairs target currently holds - 0 for an empty map, up to target's own declared capacity once it is full.
map_remove
Removes key (and its value) from target if present. Returns true if something was removed, false if key was not present (target is unchanged either way, never an error).
map_set
Stores value at key in target, a map - inserting key if it is new, or OVERWRITING the existing value if key was already present. Returns true if target now holds key/value; false only if key was new AND target was already full (nothing is changed - target never crashes or corrupts). Overwriting an EXISTING key always succeeds, even when target is full, since it never grows target.

Maths

Numbers and text
A map of the two kinds of value almost every game is built from - numbers you calculate with and text you show - and which page covers which.
Numbers
Whole numbers and fractional numbers are two different things on the Game Boy Advance, and knowing which one you have decides what a division, a multiplication or a rounding gives you.
abs
value without its sign - always zero or positive. abs(-7) and abs(7) are both 7.
abs_int
The same as abs, for a whole number: value without its sign, always zero or positive, and the answer is a whole number. Use this one whenever the number is counted rather than measured - how many slots apart two things are, how many frames either side of a moment - so the variable you keep it in stays a whole number.
angle_approach
Turns from angle from toward angle to by step degrees, the SHORT way round, and never overshoots - landing exactly on to once step would carry it past.
angle_cos
The cosine of angle (degrees, 0 = east, counterclockwise) - a value from -1 to 1.
angle_diff
The signed SHORTEST turn from angle from to angle to, in degrees - positive is counterclockwise, negative is clockwise, and the result is always in (-180, 180].
angle_sin
The sine of angle (degrees, 0 = east, counterclockwise) - a value from -1 to 1.
angle_tan
The tangent of angle (degrees, 0 = east, counterclockwise) - sine divided by cosine.
approach
Moves start toward end by step, and never overshoots - landing exactly on end once step would carry it past.
approach_int
The same as approach, for whole numbers: moves start toward end by step and never overshoots - landing exactly on end once step would carry it past - and the answer is a whole number. Use this one for something counted that should creep toward a target a little each frame, such as a score display catching up with the real score.
average
The number halfway between a and b - average(4, 10) is 7. Give it as many numbers as you like, two or more: average(2, 4, 9) is 5.
ceil
value rounded UP to a whole number, toward POSITIVE INFINITY, and handed back as a real - 1.1 becomes 2, and -1.1 becomes -1.
clamp
value, pushed back between lo and hi if it has wandered outside them - keeping a position inside a room, a health bar between 0 and its maximum, anything with a hard floor and ceiling.
clamp_int
The same as clamp, for whole numbers: value pushed back between lo and hi if it has wandered outside them, and the answer is a whole number. Use this one whenever the thing you are clamping is counted rather than measured - a slot number, a level, a lives count - so it stays a whole number.
dir_to
The direction in degrees from the first point to the second (0 = east, counterclockwise).
dir_x
The x component of a direction/length pair - how far right (negative length: left) a step of that length in that direction reaches.
dir_y
The y component of a direction/length pair - how far down (negative length: up) a step of that length in that direction reaches, matching the room’s own y-down convention.
dist_sq
The distance between two points MULTIPLIED BY ITSELF, with no square root, so it is quick. Use it to ask "which is closer" or "is it near enough" for lots of things at once: dist_sq(x, y, other.x, other.y) < square_int(32) means "within 32 pixels". The answer is a whole number.
dist_to
The straight-line distance between two points, in pixels - dir_to’s own partner for anything that needs to know both which way and how far.
floor
value rounded DOWN to a whole number, toward NEGATIVE INFINITY, and handed back as a real - 1.9 becomes 1, and -1.9 becomes -2.
frac_part
The fractional part of value, with the whole number simply dropped - 3.75 becomes 0.75, and -3.75 becomes -0.75 (the sign stays, never rounded).
int_ceil
The smallest int not less than value, rounding toward POSITIVE INFINITY - 1.1 becomes 2, and -1.1 becomes -1 (int_part would say -1 too, but int_floor would say -2).
int_floor
The largest int not greater than value, rounding toward NEGATIVE INFINITY - 1.9 becomes 1 (same as int_part), but -1.9 becomes -2 (int_part would say -1).
int_part
The integer part of value, with the fractional part simply dropped - 1.9 becomes 1, and -1.9 becomes -1 (toward zero, never rounded).
int_round
The nearest int to value - 1.4 becomes 1, 1.5 becomes 2, and -1.5 becomes -2 (an exact tie rounds away from zero, matching the fixed-point type’s own nearest-whole-number rounding).
inverse_lerp
Says how far value is from a to b as a number from 0 to 1: 0 when value is a, 1 when it is b, 0.5 halfway. It is lerp turned round. Use it to turn a health of 0 to 50 into a bar that is 0 to 1 full: fill = inverse_lerp(0, 50, hp).
lerp
The point amount of the way from a to b - 0 gives a, 1 gives b, 0.5 the midpoint. Smoothing a camera or a displayed value toward its real target a little every frame is the commonest use.
max
The larger of a and b.
max_int
The same as max, for whole numbers: the larger of a and b, and the answer is a whole number. Use this one whenever the numbers are counted rather than measured - a lives count, a slot number, a picture number - so the variable you keep it in stays a whole number.
min
The smaller of a and b.
min_int
The same as min, for whole numbers: the smaller of a and b, and the answer is a whole number. Use this one whenever the numbers are counted rather than measured - a lives count, a slot number, a picture number - so the variable you keep it in stays a whole number.
modulo
What is left over after dividing a by b, and never less than 0: modulo(7, 5) is 2, and modulo(-1, 5) is 4. Use it to make a counter or an angle go round and round - modulo(angle + 10, 360) never leaves 0 up to 360. The % sign and the word mod do the same sum but can give a negative answer (-1 % 5 is -1); modulo does not.
modulo_int
The same as modulo, for whole numbers: what is left over after dividing a by b, never less than 0, and the answer is a whole number. modulo_int(-1, 5) is 4. Use it for something counted, such as which of 4 pictures is next: picture = modulo_int(picture + 1, 4).
noise
A number from 0 to 1 that changes smoothly, not in jumps like roll_real: feed it a number that grows slowly, such as game_frame() * 0.02, and you get a wobble that never repeats in a way you can see. Use it for wind, a wandering enemy, a floating thing or a flickering flame. Give it a second number and it makes a flat sheet of noise, such as a lumpy landscape.
power
value multiplied by itself exponent times - power(2, 3) is 8 and power(10, 2) is 100. The exponent has to be a whole number; power(2, 0.5) is refused when the project is checked. An answer bigger than about 524,000 goes wrong.
power_int
The same as power, for whole numbers: value multiplied by itself exponent times, and the answer is a whole number. power_int(2, 3) is 8 and power_int(10, 6) is 1000000 - a whole number goes much further than a real, which has already run out by 10 to the power of 6. Both numbers have to be whole, as the exponent already has to be for power.
roll_chance
True roughly `percent` times in every hundred it is asked - 0 never, 100 always. For "does this happen this frame?": a flicker, a spark, a rare drop.
roll_int
A whole number between lo and hi, both ends included - roll_int(1, 6) is a dice roll, roll_int(-1, 1) is a step either way or none at all.
roll_one_of
One item picked by chance, every item equally likely. Give it a list - roll_one_of(frames) hands back one of the numbers in frames - or just write the choices out: roll_one_of(10, 20, 30). They can be any kind of thing: whole numbers, decimals, text.
roll_real
A real number between lo and hi, both ends included - roll_real(0, 360) is any direction, roll_real(0.8, 1.2) a small wobble either side of 1.
roll_reseed
Starts the roll stream again from `seed`. Every run of a ROM rolls the same numbers in the same order unless something calls this, so this is how a project asks for a different game each time.
round
value rounded to the NEAREST whole number and handed back as a real - 1.4 becomes 1, 1.5 becomes 2, and -1.5 becomes -2 (an exact tie rounds away from zero).
sign
-1 when value is negative, 1 when it is positive, 0 when it is exactly 0.
sign_int
The same as sign, for a whole number: -1 when value is negative, 1 when it is positive, 0 when it is exactly 0 - and the answer is a whole number, so it can go on to anything that wants one, such as the frame of draw_sprite.
sqrt
The square root of value - the length of a right triangle’s hypotenuse once you already have dx² + dy², or anywhere else a real square root is needed.
square
value times itself - square(5) is 25. Numbers bigger than about 724 go wrong, because their square no longer fits in a real.
square_int
The same as square, for a whole number: value times itself - square_int(5) is 25 - and the answer is a whole number. Use this one for something counted, such as an area in tiles or a squared distance in whole pixels, so the variable you keep it in stays a whole number. Numbers bigger than about 46,340 go wrong, because their square no longer fits.
wave
A value that rises and falls between min and max and back, forever, like a slow pulse - a torch's glow, a pickup floating up and down, a menu highlight breathing in and out.
wrap
Steps value off one end of [min, max] and reappears at the other - a menu index looping from the last row back to the first, a small cycling counter. NOT a modulo wrap - see the "On the GBA" note before reaching for this the way you would % elsewhere.
wrap_int
The same as wrap, for whole numbers: steps value off one end of [min, max] and reappears at the other, and the answer is a whole number. Use this one for a menu row or a counter that loops - `row = wrap_int(row + 1, 0, rows - 1);` - so the variable you keep it in stays a whole number. NOT a modulo wrap - see the "On the GBA" note before reaching for this the way you would % elsewhere.

Motion

Motion and pathing
An instance can be moved by giving it a speed, by setting its position, or by handing it a path to follow - three different jobs with different rules.
direction
The direction `speed` moves this instance in, in degrees (0 = east, counterclockwise).
friction
How much `speed` shrinks toward 0 every frame.
gravity
How much speed is added toward `gravity_dir` every frame. It only adds speed: like `speed` and `hsp` / `vsp` it does NOT stop at walls, floors or solid objects, so an object with gravity falls straight through them. To land on something, move with `move_slide` (tiles) or `move_slide_solid` (tiles and solid objects) and set `vsp` to 0 when it stops, as the Player movement designer does, or use a Behaviors state.
gravity_dir
The direction `gravity` pulls in, in degrees (0 = east, counterclockwise). Defaults to 270 (straight down); 90 points straight up.
hsp
Horizontal speed, in pixels per frame - positive is right.
lands_on_solids
Whether this instance stops on solid tiles and solid objects as it moves (true), or passes through them like `gravity` and `hsp` / `vsp` alone do (false, the default). The object's "Lands on solids" box sets where it starts.
move_bounce
Moves this instance by its own hsp/vsp against the current room’s collision; a blocked axis REVERSES that axis’s speed instead of merely stopping.
move_slide
Moves by (dx, dy) against the current room’s own collision, sliding along whatever it hits (the corner-nudge slide top-down movement wants) instead of stopping dead.
move_slide_solid
Moves by (dx, dy) against the current room’s own collision AND the live SOLID instances of the objects you name, all tested together in one pass - the corner-nudge slide works against these object types too, not just the room’s own tile layer/obstacles. Name as many objects as you like: move_slide_solid(dx, dy, obj_wall, obj_rock). A parent object also covers all of its children.
move_snap
Rounds this instance’s position to the nearest multiple of grid_x/grid_y on each axis. 0 or a negative value leaves that axis untouched.
move_step
Steps `distance` pixels along this instance’s own current `direction` - a one-off nudge, independent of hsp/vsp/speed, and not something that accumulates on its own.
move_to
Moves instantly to (x, y) - no gradual travel, no collision check.
move_wrap
Wraps this instance to the opposite edge of the given rectangle (typically the room’s own bounds) once it leaves it by more than margin.
on_ground
True when the last movement step ended with this instance resting on something below it. Only kept up to date while `lands_on_solids` is true. The engine writes it every step: read it, do not set it.
speed
Speed along `direction`, in pixels per frame.
vsp
Vertical speed, in pixels per frame - positive is down.

Paths

Paths
A path is a route drawn once in the editor, which any number of instances can be told to follow, with a choice of what happens when they reach the end.
path
Which path this instance is following, if any (nothing if it is not on one). Set by path_start(), cleared by path_stop() or reaching the end with PATH_STOP.
path_end_do
What happens when this instance reaches the end of its path - always one of the PATH_* constants (PATH_STOP, PATH_LOOP, PATH_PING_PONG, PATH_CONTINUE). path_start()’s third argument sets it; read or assign it any time to check or change what the path does when it runs out.
path_length
A path’s total length in pixels (after smoothing is sampled into straight segments, S3.9).
path_point_count
How many points a path has.
path_point_x
The x position of point i on a path (0 if i is out of range).
path_point_y
The y position of point i on a path (0 if i is out of range).
path_pos
How far along the current path this instance is, from 0 to 1.
path_speed
How fast this instance moves along its current path, in pixels per frame (NOT a 0..1 fraction).
path_start
Starts this instance following a path. Give a speed to go at that speed all the way, or leave the speed out to go at the speed of each line, as set in the Paths tab.
path_stop
Stops this instance following its current path (a no-op if it was not following one) - leaves its position exactly where it was.
path_x_at
The x position at pos (0..1) along a path, without moving anything.
path_y_at
The y position at pos (0..1) along a path, without moving anything.

Queues

Queues
queue is a line - items join at the back and leave from the front, so the item that has waited longest is always the next one out.
queue_clear
Removes every item from target, leaving it empty (queue_length(target) becomes 0, queue_empty(target) becomes true). target's own declared capacity is unchanged - it can be filled again afterward.
queue_contains
True if any item in target equals value, false otherwise (including when target is empty). Nothing in target changes, and no item is taken off the front.
queue_copy
Makes a new queue that is a copy of source: the same items in the same order, with the same item at the front, and the same capacity. Changing the copy never changes source, and the other way round. It goes on the right-hand side of the line that makes the variable, like queue_create, and it costs a whole second queue of memory.
queue_create
Makes an empty queue that can hold up to capacity items. example is any value of the kind it will hold - queue_create(16, 0) is a queue - and is never put in the queue. capacity must be a whole number written right there in the code, and a power of two (2, 4, 8, 16, 32...).
queue_empty
True if target currently holds no items, false otherwise. The way to know, BEFORE calling queue_pop/queue_peek, whether the value they would give back is a real item or just the empty-container default.
queue_length
How many items target currently holds - 0 for an empty queue, up to target's own declared capacity once it is full.
queue_peek
Reads the item at the FRONT of target WITHOUT removing it. If target is empty, returns a plain default value instead (see queue_pop's own note on what that is per type) - target is left unchanged either way.
queue_pop
Removes AND returns the item at the FRONT of target (the one pushed longest ago). If target is already empty, nothing is removed and a plain default value is returned instead (0/0.0/false/an empty string/`nothing`, depending on T) - target never crashes. Check queue_empty(target) first if you need to tell "the front was really this value" apart from "target was empty".
queue_push
Pushes value onto the back of target, a queue - first in, first out. Returns true if it fit, false if target was already full (nothing is pushed - target never crashes or corrupts, it just stops growing).

Rooms

Rooms and saving
A map of how a game is split into rooms and how it remembers anything between them and between plays - and which page covers which.
Moving between rooms
A game is a set of rooms and only one is loaded at a time, so leaving a room means playing a transition, tearing the old room down, building the next, and choosing what, if anything, comes along.
Persistent rooms
A room marked Persistent is kept when the player leaves it - every object exactly as it was - and is there again on the way back. This page says what is kept, what runs when the player returns, how many rooms the game remembers, and what it costs.
What a world remembers
Things that stay done, roamers, changed tiles and travel between worlds, and what is saved.
What a region does in the game
Each region's tile sets, song and background color, a shroud on some pieces, and the two calls that say which region the player is in.
Regions in a long room
Why a long, varied room is cut into regions, how to make them fit with the fewest tiles, and what a region's song, events and calls do in the game.
door_is_locked
True if the door whose own door_id is door is currently locked. door may be the door’s own name (given it in the Room Editor) - resolved to its door_id at compile time, for free - or a door_id int, literal or computed.
door_lock
Locks the door whose own door_id is door: it stops sending (acting as an Enter door) until unlocked. door may be the door’s own name (given it in the Room Editor) - resolved to its door_id at compile time, for free - or a door_id int, literal or computed.
door_mode
The door whose own door_id is door’s current mode - one of DOOR_TWO_WAY, DOOR_ENTER_ONLY or DOOR_EXIT_ONLY. Compare it with ==, the same way tile_class is compared. door may be the door’s own name (given it in the Room Editor) - resolved to its door_id at compile time, for free - or a door_id int, literal or computed.
door_set_mode
Sets the door whose own door_id is door to mode - DOOR_TWO_WAY, DOOR_ENTER_ONLY or DOOR_EXIT_ONLY. Target first, matching tile_set_class(x, y, cls) - the setter twin of door_mode. door may be the door’s own name (given it in the Room Editor) - resolved to its door_id at compile time, for free - or a door_id int, literal or computed.
door_unlock
Unlocks the door whose own door_id is door, letting it send (act as an Enter door) again. door may be the door’s own name (given it in the Room Editor) - resolved to its door_id at compile time, for free - or a door_id int, literal or computed.
region_at
The region at a place in the world, as a region word like rg_forest: a place anywhere in the world the player is in, not only the part that is on screen. Handy for a roaming enemy that must stay out of the crypt. In a long room cut into regions it is a place in that room. -1 for a place outside the world or the room.
region_current
Which region the player is in, as a number you compare with the region words your game gets: rg_forest for a region called "Forest", rg_the_old_road for "The Old Road". It is the last region the player was in, so it stays right inside a house. -1 before the player has been in any. It works in a long room cut into regions too: the player is the object the camera follows.
region_entered
True for one frame when the player arrives in a different region than the last one they were in: show the region's name, start a weather effect, give the player a hint. False in every other frame. It is true once when the game starts, for the region the player starts in, and again each time the player crosses into another region.
region_exited
True for one frame, the same frame as region_entered(), when the player leaves one region by arriving in another: use region_previous() to see which one was left. False in every other frame, and not true when the game starts, because nothing was left then.
region_music
The song of the region the player is in: the one you picked for it in the Regions list, or the one region_set_music gave it. Nothing when the region has no song.
region_name
The name of the region of the world the player is in, as you named it in the Regions list ("Forest", "The Old Road"); in a long room cut into regions, the region the object the camera follows stands in. In a room that has no regions it is still the last region the player was in. An empty text before the player has been in any.
region_previous
The region the player was in before the last change of region, as a region word like rg_forest. It stays the same until the next change. -1 before the player has changed region once.
region_set_music
Gives the region the player is in another song and starts it now, the way music_fade_to changes a song. From then on that region plays the new song whenever the player walks into it. The change lasts for the rest of the game and is saved with the game, so a region whose music you changed after a story event stays changed when the game is loaded.
roam_boundary
Makes this thing a roamer of its world: free to move anywhere inside the rectangle from (min_x, min_y) to (max_x, max_y), in places of the world. The game keeps it inside. When the part of the world it is in is left behind it waits where it was, with every value it had, and when a part that holds its place is loaded again it comes back there. Call it again to move the rectangle. roam_stop() makes it an ordinary thing again.
roam_stop
Makes this roamer an ordinary thing again: it belongs to the part of the world it is in, and goes when that part goes.
room_bottom
The y coordinate of the current room’s bottom edge - the line where the room ends, one past the last pixel inside it.
room_change
Starts a transition to room r, using the CURRENT room’s own transition_on_exit (the room being LEFT chooses it). A no-op if a transition is already running, or r is out of range.
room_change_ext
Like room_change, but also carries target - an existing instance, or nothing - into room r, places it at (x, y) - a spot in room r, counted from that room’s top-left corner - the instant the transition’s hidden LOAD runs, and plays transition instead of r’s own default. “Should work like teleporters already do.”
room_change_seamless
Goes to room r with no fade and no transition, so the player does not see it happen. This instance and the camera come through moved by (offset_x, offset_y) - new place = old place + offset - which is what keeps the picture the same on both sides. The optional fourth value, carry_within (pixels, 0 when left out), also carries every instance within that distance of this one, moved the same way.
room_current
Which room is active right now.
room_forget
Makes the game forget room r if it was keeping it, so the next time the player goes there it is built new from what you placed in it.
room_forget_all
Makes the game forget every room it was keeping, so each one is built new from what you placed in it the next time the player goes there.
room_height
The current room’s height, in pixels.
room_height_of
The height, in pixels, of any room in the project - not only the one you are in.
room_left
The x coordinate of the current room’s left edge. Because (0, 0) is the room’s top-left corner it is 0, but writing room_left() says what you mean, so the code reads clearly and stays right even in an older project that counts from the middle.
room_next
Goes to the next room in room order, wrapping to the first past the last.
room_restart
Reloads the current room from scratch, as if room_change(room_current()) had been called, using the room’s own transition_on_exit.
room_right
The x coordinate of the current room’s right edge - the line where the room ends, one past the last pixel inside it.
room_set_shroud_darkness
Changes how dark the current dark room is, in percent, while the game runs. 0 shows the room as if it were lit and 100 is black. Only the darkness changes: the lights you made still cut their holes through it.
room_top
The y coordinate of the current room’s top edge - the vertical partner of room_left.
room_width
The current room’s width, in pixels.
room_width_of
The width, in pixels, of any room in the project - not only the one you are in. Handy before you go there, for example to place something inside the next room with room_change_ext.
world_current
Which world the player is in: 0 for the first world in your list, 1 for the second, and so on; -1 in a room that is not part of a world. Every place the game reads or writes is a place in this world.
world_go
Takes the player to another world (0 is the first world in your list, 1 the second), to the place (x, y) of that world, with a room change that plays a transition: the one you give as the fourth value, or the usual one when you leave it out. Each world keeps its own memory: what was opened or taken, the changed tiles. Going back to a world finds it as it was left.
world_remember
Marks this thing as done in the world: the world remembers it for good. A chest that has been opened, a gate that has been unlocked. It only does something for a thing placed in a world with "Remembered in the world" turned on. world_remember(false) takes the mark off again.
world_remembered
True when the world remembers this thing as done (world_remember() was called for it, or a thing of its kind was destroyed). Ask it in a Create event to show a chest open, a gate unlocked or a lever already pulled when the player walks back.

Save

Screen

Overlay effects - screen effects you make yourself
An overlay effect is a screen effect row by row (see-through, brightness, blocks, wobble, stretch, sky color, tint, a shape) that moves, pulses or stands still, made in the Overlay Effects tab and played with overlay_start. A transition is one that hides a room change.
green_swap
Turns the screen’s green swap on or off: every pair of side-by-side pixels trades their green, which gives the picture a grainy, interlaced shimmer.
overlay_active
True while an overlay effect is playing. An effect that pulses once is over after its last frame, and every overlay ends when a room is loaded.
overlay_area
Puts the Area of the overlay effect that is playing with its top-left corner at the spot (x, y) on the screen, counted from the screen’s top-left corner. A band only moves up and down (it is the whole width). Call it after overlay_start; it does nothing for an effect with no Area.
overlay_area_follow
Keeps the Area of the overlay effect that is playing on an object: its top-left corner stays at the place where the object is on the screen, plus dx across and dy down, every frame, whatever the camera does. A heat haze over a campfire is overlay_area_follow(campfire, -16, -40). Call it after overlay_start.
overlay_change
Changes the screen effect that is playing now into another one over so many frames. A day tint turns into night, a calm heat haze turns into a storm. overlay_change(nothing, frames) fades the effect away and then stops it; with no effect playing, the new one fades in. With frames at 0 it happens at once, like overlay_start and overlay_stop. Amounts such as See-through, Brightness, Blocks, Wobble, Stretch, Sky color and Tint blend smoothly from one effect to the other; what cannot be mixed fades out in the first half and the new one fades in during the second.
overlay_focus
Moves the middle of the overlay effect’s Shape to the spot (x, y) on the screen, counted from the screen’s top-left corner. A spotlight follows the player when you call this every frame with the player’s place on the screen.
overlay_start
Plays an overlay effect: a screen effect you made in the Overlay Effects tab, such as Lightning, Heat haze or Teleport. It changes the screen row by row, and moves, pulses or stands still the way the effect says. Only one overlay plays at a time: starting another one replaces the first. overlay_start(nothing) stops it. Give the optional last argument layer (ROOM_LAYER_MAIN, ROOM_LAYER_FRONT or ROOM_LAYER_BACK) to play it on that one tile layer only: overlay_start(ov_haze, ROOM_LAYER_BACK) hazes the Back layer and leaves the Main and Front layers as they are. An effect that changes the whole screen (a Sky color, a Brightness with a color, an Area) is not cut to a layer. With no layer the call is the call it always was.
overlay_stop
Stops the overlay effect that is playing, if there is one, and puts the screen back the way it was. It does nothing when no overlay is playing.
screen_backdrop
Gives the screen’s backdrop (the color behind everything) a different color on every row, for example a sunset sky. look is one of the BACKDROP_ constants, strength (1 to 3) is how rich the colors are, and speed is how fast the sky slowly drifts. BACKDROP_NONE turns it off.
screen_backdrop_gradient
Gives the screen’s backdrop (the color behind everything) a sky of your own colors: top is the color of the first row of the screen, middle the color halfway down and bottom the color of the last row, with a smooth blend in between. Use color literals like #1F3A7C. It stands still. Turn it off with screen_backdrop(BACKDROP_NONE, 0, 0).
screen_blend
Changes how much of every see-through thing shows on each row of the screen: a dark room gets dark edges, a mist thins out toward the floor. look is one of the BLEND_ constants, strength (1 to 3) is how strong it is, and speed is how fast a moving look travels down the screen. BLEND_NONE turns it off. Give the optional last argument layer (ROOM_LAYER_MAIN, ROOM_LAYER_FRONT or ROOM_LAYER_BACK) to fade only that one tile layer of the room: screen_blend(BLEND_FADE_DOWN, 2, 0, ROOM_LAYER_BACK) fades the Back layer and leaves the Main and Front layers as they are. With no layer the look reaches everything it always did.
screen_contrast
Changes how strong the colors of the whole screen are: backgrounds and sprites together. 0 leaves the colors alone and 1 is the strongest, so the dark parts get darker and the bright parts get brighter. A number below 0 counts as 0 and a number above 1 counts as 1. It ends when the next room loads.
screen_fade
Fades the whole picture into one color over so many frames and keeps it that color, without changing room: screen_fade(COLOR_BLACK, 30) darkens the screen in half a second. Use screen_fade_in to bring the picture back. Good for a cutscene, a death or the end of a level.
screen_fade_in
Takes the color screen_fade put over the picture away again over so many frames, so the picture is back to normal: screen_fade_in(30). It does nothing visible when no fade is on.
screen_flash
Makes the whole picture that color AT ONCE, then fades it back to normal over so many frames, without changing room: screen_flash(COLOR_WHITE, 8) is a quick white hit flash. Use it when something is hurt, a lightning bolt strikes or a switch is thrown.
screen_mosaic
Turns the things you marked blocky (backgrounds, objects, and a room’s tiles) into big square blocks, a different size on each row if the look says so, so a picture can come into focus from the top down. look is one of the MOSAIC_ constants, strength (1 to 3) is how big the blocks are, and speed is how fast a moving look travels. MOSAIC_NONE turns it off. Give the optional last argument layer (ROOM_LAYER_MAIN, ROOM_LAYER_FRONT or ROOM_LAYER_BACK) to make only that one tile layer of the room blocky: screen_mosaic(MOSAIC_BLOCKS, 2, 0, ROOM_LAYER_FRONT) turns the Front layer into blocks and leaves the Main and Back layers sharp. With no layer the look reaches everything it always did.
screen_scanlines
Swaps the green of every pair of side-by-side pixels on some rows of the screen and not on others, which gives the whole picture the fine lines of an old television. look is one of the SCANLINES_ constants, strength (1 to 3) is how many rows are swapped, and speed is how fast a moving look travels down the screen. SCANLINES_NONE turns it off.

Scripts

Sets

Sets
set remembers which values you have seen - each one is either in it or not, with no order, no duplicates and no value attached.
set_add
Adds value to target, a set, if it is not already a member. Returns true if target contains value AFTER this call - whether it was already there or was just added - false ONLY if value was new and target was already full (nothing changes - target never crashes or corrupts). Adding a value that is already a member is always safe and always reports true, never a failure.
set_clear
Removes every value from target, leaving it empty (set_length(target) becomes 0). target's own declared capacity is unchanged - it can be filled again afterward.
set_contains
True if value is currently a member of target, false otherwise. Exactly the same as set_has - this is the name that matches list_contains, stack_contains and queue_contains.
set_copy
Makes a new set that is a copy of source: the same values, and the same capacity. Changing the copy never changes source, and the other way round. It goes on the right-hand side of the line that makes the variable, like set_create, and it costs a whole second set of memory.
set_create
Makes an empty set that can hold up to capacity different values. example is any value of the kind it will hold - set_create(16, 0) is a set - and is never put in the set. capacity must be a whole number written right there in the code, and a power of two (2, 4, 8, 16, 32...).
set_has
True if value is currently a member of target, false otherwise.
set_length
How many distinct values target currently holds - 0 for an empty set, up to target's own declared capacity once it is full.
set_remove
Removes value from target if it is a member. Returns true if something was removed, false if value was not a member (target is unchanged either way, never an error).

Stacks

Stacks
stack is a pile you can only touch from the top - the last thing pushed on is the first thing to come off, which is what an undo history or a "back" trail needs.
stack_clear
Removes every item from target, leaving it empty (stack_length(target) becomes 0, stack_empty(target) becomes true). target's own declared capacity is unchanged - it can be filled again afterward.
stack_contains
True if any item in target equals value, false otherwise (including when target is empty). Nothing in target changes, and no item is taken off.
stack_copy
Makes a new stack that is a copy of source: the same items in the same order, with the same item on top, and the same capacity. Changing the copy never changes source, and the other way round. It goes on the right-hand side of the line that makes the variable, like stack_create, and it costs a whole second stack of memory.
stack_create
Makes an empty stack that can hold up to capacity items. example is any value of the kind it will hold - stack_create(16, 0) is a stack - and is never put in the stack. capacity must be a whole number written right there in the code.
stack_empty
True if target currently holds no items, false otherwise. The way to know, BEFORE calling stack_pop/stack_peek, whether the value they would give back is a real item or just the empty-container default.
stack_length
How many items target currently holds - 0 for an empty stack, up to target's own declared capacity once it is full.
stack_peek
Reads the item at the top of target WITHOUT removing it. If target is empty, returns a plain default value instead (see stack_pop's own note on what that is per type) - target is left unchanged either way.
stack_pop
Removes AND returns the item at the top of target. If target is already empty, nothing is removed and a plain default value is returned instead (0/0.0/false/an empty string/`nothing`, depending on T) - target never crashes. Check stack_empty(target) first if you need to tell "the top was really this value" apart from "target was empty".
stack_push
Pushes value onto the top of target, a stack - a container with only ONE end anyone may ever touch. Returns true if it fit, false if target was already full (nothing is pushed - target never crashes or corrupts, it just stops growing).

Strings

Text
Text in a program is a row of characters with a fixed maximum length that you choose when you write the code, and GBML gives you functions to join it, cut it, search it and turn numbers into it.
string
n written out as text, for building a line of text around a number - converting a number to text. string(5) is "5".
string_char_at
The single character at index (0-based), as a one-character string - getting a single character.
string_code_at
The number of the single character at index (0-based) - string_char_at's partner: char_at gives the character as text, code_at gives it as a number ("A" is 65, "a" is 97, "0" is 48).
string_count
How many times part appears in text - string_count("banana", "an") is 2. It only counts; it builds no string, so there is nothing to cut off.
string_delete
text with count characters taken out, starting at position at (0-based) - string_delete("chat", 1, 1) is "cat". The result is never longer than text, so it never runs out of room.
string_digits
A whole number written as text with at least count digits, filled with zeros in front: string_digits(7, 3) is "007" and string_digits(5, 2) is "05". Made for clocks and scores: string_join(string_digits(minutes, 2), string_join(":", string_digits(seconds, 2))) is "01:07".
string_find
The index of the first needle inside s, or -1 if it is not there - finding text inside a string.
string_from_number
The older name of string: n written out as text. It still works and does exactly the same; new code can write string(n).
string_insert
text with part pushed in at position at (0-based) - string_insert("cat", "h", 1) is "chat". The result is longer than text, so if it does not fit in a string, the END of the result is quietly cut off: the last letters of text (and, if even that is not enough, the end of part) are the ones lost.
string_join
a followed by b - joining two strings. Join more than two by calling it again: string_join(string_join(a, b), c).
string_length
How many characters s currently holds - up to its own declared capacity, never more.
string_lower
s with every letter changed to lower case - changing case.
string_pad_left
Adds fill in front of s until it is width characters long, so text lines up: string_pad_left("7", 3, "0") is "007" and string_pad_left("42", 5, " ") is " 42". Only the first character of fill is used. Text that is already long enough comes back as it was.
string_pad_right
Adds fill after s until it is width characters long, so columns line up: string_pad_right("hp", 5, ".") is "hp...". Only the first character of fill is used. Text that is already long enough comes back as it was.
string_repeat
text written out times times in a row - string_repeat("ab", 3) is "ababab". A string has only so much room: if the result would not fit, it is quietly cut off at the end, so string_repeat("ab", 1000) is one full string of "abab...", not a thousand of anything.
string_replace
Every occurrence of target inside s, replaced with replacement - replacing text.
string_slice
Up to count characters of s, starting at start (0-based) - taking part of a string.
string_to_number
s read as a number - converting text to a number, e.g. reading back a value someone typed on a name/number entry screen.
string_trim
s with any leading/trailing spaces removed - trimming, e.g. cleaning up a name typed on an entry screen.
string_upper
s with every letter changed to UPPER CASE - changing case.

Text

Drawing text
Text on a GBA is a row of small sprites, one per character, so every word you draw spends from the same budget as everything else on screen.
draw_text
Draws text in world space (scrolls with the camera) - e.g. a floating damage number over an enemy. Inside a Draw GUI event it is fixed to the screen instead (a HUD), and (x, y) counts from the screen’s top-left pixel.
draw_text_3d
Draws text in world space with the line curving away from you, as if it were wrapped round a barrel or a sign tipped back - the top and bottom of the letters shrink back and the middle stays full size. shape picks the look: TEXT_BULGE, TEXT_LEAN_BACK and TEXT_LEAN_FORWARD choose which part of the line shrinks, and TEXT_DRUM is different - it fixes a lens on the middle of the screen and the words slide through it (see TEXT_DRUM). TEXT_BAND is a lens fixed on the screen too, but a narrow 64-row band, the shape of the WARNING word in a boss introduction (see TEXT_BAND). depth says how much, up to 6: 1 is gentle, 3 is deep, and 4, 5 and 6 are far deeper, down to a thin sliver at the far edge of the letters, and want a big, bold font. (x, y) is the same LEFT/CENTER/RIGHT anchor draw_text already uses. Inside a Draw GUI event it is fixed to the screen instead, and (x, y) counts from the screen’s top-left pixel - a title or banner that stays put when the camera moves.
draw_text_3d_anchored
draw_text_3d, but the position is measured from a spot on the screen (ANCHOR_TOP_CENTER, ANCHOR_BOTTOM_RIGHT, ...) instead of from the top-left corner, and it is fixed to the screen wherever you call it - a banner that curves away from you and stays at the top of the screen on any screen. shape and depth work exactly as they do in draw_text_3d: depth goes up to 6, and TEXT_DRUM slides the word through a lens fixed on the middle of the screen.
draw_text_3d_scaled
draw_text_3d at any size: draws text in world space with the line curving away from you, and xscale and yscale make the whole line wider and taller (or smaller) the way they do in draw_text_warped. The curve grows with the text, so a depth means the same thing at any size. shape and depth work exactly as they do in draw_text_3d: depth goes up to 6, and TEXT_DRUM slides the word through a lens fixed on the middle of the screen. A negative xscale or yscale flips the whole line, curve and all (a yscale of -1 is a reflection). (x, y) is the same LEFT/CENTER/RIGHT anchor draw_text already uses, and the point the line grows from. Inside a Draw GUI event it is fixed to the screen instead, and (x, y) counts from the screen’s top-left pixel.
draw_text_3d_sheared
draw_text_3d with the whole line leaned the way italic writing leans: draws text in world space with the line curving away from you, and xshear slides the top of the letters sideways (a positive number leans them right, a negative number leans them left, and 0 is exactly draw_text_3d). shape and depth work exactly as they do in draw_text_3d: depth goes up to 6, and TEXT_DRUM and TEXT_BAND slide the word through a lens fixed on the middle of the screen. (x, y) is the same LEFT/CENTER/RIGHT anchor draw_text already uses. Inside a Draw GUI event it is fixed to the screen instead, and (x, y) counts from the screen’s top-left pixel.
draw_text_3d_sheared_scaled
draw_text_3d_sheared at any size: draws text in world space with the line curving away from you, leaned the way italic writing leans, and made wider and taller (or smaller) by xscale and yscale. xshear slides the top of the letters sideways (a positive number leans them right, a negative number leans them left, and 0 is exactly draw_text_3d_scaled), and it means the same at every size: 0.5 is half a pixel sideways for every pixel up or down on the screen. shape and depth work exactly as they do in draw_text_3d: depth goes up to 6, and the curve grows with the text, so a depth means the same thing at any size. A negative xscale or yscale flips the whole line, curve and all. (x, y) is the same LEFT/CENTER/RIGHT anchor draw_text already uses, and the point the line grows from; it counts from the top-left, like every other world position. Inside a Draw GUI event it is fixed to the screen instead, and (x, y) counts from the screen’s top-left pixel.
draw_text_anchored
draw_text, but the position is measured from a spot on the screen (ANCHOR_TOP_LEFT, ANCHOR_BOTTOM_RIGHT, ...) instead of from the top-left corner, and it is fixed to the screen wherever you call it - so a score can say "4 pixels in from the top-left corner" and mean it on any screen.
draw_text_sheared
Draws text in world space, scaled, turned and slanted: everything draw_text_warped does, plus two more numbers that slant the whole line the way italic writing slants. xshear slides the top of the letters sideways (a positive number leans them right) and yshear lifts one end of the line (a positive number lifts the right end). (x, y) is the same LEFT/CENTER/RIGHT anchor draw_text already uses, and the point the line is scaled, turned and slanted around, so the line stays where you put it. Inside a Draw GUI event it is fixed to the screen instead, and (x, y) counts from the screen’s top-left pixel.
draw_text_warped
Draws text in world space, scaled and rotated - a spinning title, a score that pops, anything draw_text alone cannot do. (x, y) is both the same LEFT/CENTER/RIGHT anchor text_align() already gives draw_text, and this call’s own scale/rotation pivot. Inside a Draw GUI event it is fixed to the screen instead, and (x, y) counts from the screen’s top-left pixel.
draw_text_warped_anchored
draw_text_warped, but the position is measured from a spot on the screen (ANCHOR_TOP_RIGHT, ANCHOR_CENTER, ...) instead of from the top-left corner, and it is fixed to the screen wherever you call it - a score that pops in the top-right corner stays in the top-right corner on any screen.
font_set
Chooses which font every draw_text call uses from here on, until changed again. Optional, not required before your first draw_text call - it already draws with the engine’s own built-in fallback font until this is called for the first time.
text_align
Sets how every draw_text call aligns its (x, y) against the text from here on - one of ALIGN_LEFT/ALIGN_CENTER/ALIGN_RIGHT.
text_effect_active
True while a text effect is chosen and still playing. An effect whose tracks all pulse once is over after its last frame.
text_effect_change
Changes the text effect that is playing now into another one over so many frames: the old effect fades out while the new one fades in, and the words are drawn with both of them in between. A calm wave turns into a tornado, a red glow turns into green. text_effect_change(nothing, frames) fades the effect away to plain words and then stops it. With frames at 0 it happens at once, like text_effect_start and text_effect_stop. Call it once, from any event (a Step event is the way).
text_effect_speed
Sets how fast the looks of a text effect go, from 0 to 400 percent (100 is the effect as you made it, and what it is until you call this; 50 is half as fast, 200 twice as fast, 0 stands still where it is). The percent multiplies the Speed of every look of the effect’s Letters track, so a Tornado turns faster, a Wave runs faster and a Drop in lands sooner. It does not change how long a pulse takes, or how strong the effect is (text_effect_strength does that). Call it from any event, a Step event included, and change it as the game goes: the letters speed up or slow down smoothly, they never jump.
text_effect_speed_get
The speed, in percent, a text effect was last given with text_effect_speed: 100 when it was never set (or set back to 100).
text_effect_start
Plays a text effect on every draw_text call from here until text_effect_stop: words that flash, shake, wave or change color. A text effect is made in the Overlay Effects tab, like a sprite effect, but it changes the words you draw. It is ambient, like font_set and text_palette. Call it every frame, in a Draw event, before the draw_text calls it should reach. text_effect_start(nothing) is text_effect_stop().
text_effect_stop
Words are drawn plainly again from here. Use it to keep one line plain after a line with a text effect. It does nothing when no text effect is chosen.
text_effect_strength
Sets how strong a text effect plays, from 0 to 100 percent (100 is the effect as you made it, and what it is until you call this). The percent multiplies the strength of every track of that effect, on top of the track’s own way of moving, so a pulse still rises and falls as it was made, only less far; 0 shows nothing at all, the words are drawn plainly. Call it from any event, a Step event included: change the number a little each frame (tween_to does it for you) and an effect fades in from nothing, reaches full strength and settles down to no effect at all.
text_effect_strength_get
The strength, in percent, a text effect was last given with text_effect_strength: 100 when it was never set (or set back to 100).
text_palette
Chooses the palette every draw_text call draws its letters in, from here until it is changed again - ambient state, like font_set and text_align. text_palette(nothing) goes back to the font’s own colors.

Tile Animation

Tweens

Tweens
A tween glides a number from one value to another over a number of frames - a menu sliding in, a door opening, a bar filling. Start here - it says which of the two ways to make one to use (to make something move, it is tween_to), lists all sixteen curves, and says what happens to a glide when its instance is destroyed.
ease
Bends a plain 0-to-1 progress into one of the tween curves: ease(0.5, EASE_QUAD_IN) is a number below 0.5, because that curve starts slowly. Use it to ease something you move yourself, such as a menu that slides in or a bar that fills, when you already keep the progress in a variable.
tween
Want something to MOVE? You want tween_to or tween_from_to, not this: they start right now and move a variable for you. This one only works out a number for you to use yourself - it glides from `from` to `to` over `duration` frames, starting at frame `start_frame`, speeding up or braking the way the curve says - a bar that fills smoothly, a menu that slides in, a coin that floats up. Before it starts the answer is `from`; once the time is up it is `to`, and stays `to`.
tween_count
How many tweens are gliding right now, across the whole game.
tween_from_to
tween_to with a start of your own: the variable is set to `from` right now, then glides to `to` over `duration` frames. For something that should start from a known place, like a menu that slides in from off the screen.
tween_max
The most tweens that can glide at the same moment. Fixed when the game is built - it never changes while the game is running.
tween_running
True while a glide started with tween_to or tween_from_to is still moving this variable, false once it has arrived, was stopped, or never started.
tween_stop
Stops the glide on a variable and leaves it exactly where it has got to. Does nothing if that variable is not gliding.
tween_to
Makes a variable glide from where it is now to `to` over `duration` frames, speeding up or braking the way the curve says, and leaves it at `to` when it arrives. You write the variable’s name, and the engine moves it a little every frame - there is nothing to do in a Step event.

Using the editor

Using the editor
A map of the editor guides - where objects, events, rooms and paths are made, how to build and run a game, and the small features that are easy to miss.
Learning Gbabel
The Learn tab - short lessons you do step by step in the real editor, with a lesson window that lights up the right button, notices when you are done and can do a step for you.
The Code tab
Where objects, scripts and events are authored - the project browser, the object editor, and one tab per open event.
The Macros section and skies
Where named values live in the Code tab, how to make one, and how the Build sky gradient button (in the Overlay Effects tab) turns three colors into a sky you can name and reuse.
HUD and menus
Lay out a score, a health bar, hearts or a whole menu on a screen-sized canvas. Gbabel writes the script, and you call it with one line.
The Globals section
Where the values the whole game shares live in the Code tab, what each one starts as, and what happens when the game starts over.
Behaviors
Draw how an enemy or a character acts as boxes and arrows - patrol, see the player, chase, attack - start from a ready-made one, and call it from the object's Step event.
Player movement
Pick how the player moves - a platformer, top-down, grid, ship, spin-and-thrust or auto-runner - tune it with numbers in pixels and seconds, add player actions (jump, dash, attack, shoot, interact, crouch, slide, block or your own) on buttons, see a drawing of the jump, and call it from the player's Step event.
Events in the editor
How an event becomes a file - the Add Event picker, one tab per open event, and the exact name each one is saved under.
Blocks and code
Every code window can show its code as blocks you drag around, as plain text, or (docked) both side by side. They are the same code, and the text is always the real thing.
Building code with blocks
A friendly walk through making a script by dragging blocks - the panel, dropping a block in, If/compare, holes, the gray CODE block, notes, Blocks and Text side by side, and choosing your own block colors.
Rooms, tiles and tile animation
Painting a room's tiles and placing instances in the Room Editor tab, and where animated tile groups stand today.
The Paths tab
Draw a path once, on its own grid or over a room, and assign it to as many instances as want to follow it.
Building and reading its problems
What Build and run actually does, and how a compile error in your GBML finds its way back to the exact line that caused it.
Development Build and Release Build
The two kinds of build Gbabel makes, why a development build stops and tells you what broke a rule, and how to make each one.
Playing your game inside Gbabel
Build & Play opens your finished game in the Play tab, on Gbabel's own screen - with pause, step, speed, sound, full screen, the Inspector beside it and a saved game that stays with your project, and moments you can go back to.
Your first song in five minutes
Start from a ready-made song style in the music editor, hear it, change a few notes, mute a channel and save it into your game.
The music editor
Write a song for your game in the Music tab - a grid of notes, one column for each channel, with built-in sounds, effects, ready-made song styles, play and save, for the Game Boy Advance, the Game Boy and the Game Boy Color.
The Inspector - looking inside a playing game
See every object, variable and global of your game while it plays; pause it, step one frame, change a value, and watch what you care about.
The music editor on each console
What a song can use on the Game Boy Advance, the Game Boy and the Game Boy Color - channels, kinds of sound, limits, saved file kinds, and which effects the console does itself, which Gbabel builds in, and which it cannot do.
What goes into the ROM, and how to pin something
Only the assets your project can actually reach are staged into a build - and how to keep one around anyway.
Updating Gbabel
How Gbabel checks for a newer release, what the prompt shows, and how to actually apply one today.
How the consoles differ
The consoles side by side - screen, colors, sprites, backgrounds, sound, saving and buttons.
Side by side
Every function, cutscene step and feature that a console cannot do or does in its own way, one column per console.
What each console can do
Some consoles cannot do everything the Game Boy Advance can. This page lists, console by console, what is not available and what works differently.
A tour of the Top-down template
Four objects and one room, read in the order worth reading them - a real, working project to learn GBML from.
Tips and shortcuts
The editor features that are easy to miss because nothing on screen points at them - autocomplete, search, jumping around, and working with more than one window.